Added DictionaryAdapter.build.
[castle.git] / Services / Transaction / Castle.Services.Transaction / ITransaction.cs
blobbf3f2614149889984e1bdd6a80ec75444f8b7c63
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.Services.Transaction
17 using System.Collections;
19 /// <summary>
20 ///
21 /// </summary>
22 public enum TransactionStatus
24 NoTransaction,
25 Active,
26 Committed,
27 RolledBack,
28 Invalid
31 /// <summary>
32 /// Represents the contract for a transaction.
33 /// </summary>
34 public interface ITransaction
36 /// <summary>
37 /// Starts the transaction. Implementors
38 /// should activate the apropriate resources
39 /// in order to start the underlying transaction
40 /// </summary>
41 void Begin();
43 /// <summary>
44 /// Succeed the transaction, persisting the
45 /// modifications
46 /// </summary>
47 void Commit();
49 /// <summary>
50 /// Cancels the transaction, rolling back the
51 /// modifications
52 /// </summary>
53 void Rollback();
55 /// <summary>
56 /// Signals that this transaction can only be rolledback.
57 /// This is used when the transaction is not being managed by
58 /// the callee.
59 /// </summary>
60 void SetRollbackOnly();
62 /// <summary>
63 /// Returns the current transaction status.
64 /// </summary>
65 TransactionStatus Status { get; }
67 /// <summary>
68 /// Register a participant on the transaction.
69 /// </summary>
70 /// <param name="resource"></param>
71 void Enlist(IResource resource);
73 /// <summary>
74 /// Registers a synchronization object that will be
75 /// invoked prior and after the transaction completion
76 /// (commit or rollback)
77 /// </summary>
78 /// <param name="synchronization"></param>
79 void RegisterSynchronization(ISynchronization synchronization);
81 /// <summary>
82 /// Transaction context. Can be used by applications.
83 /// </summary>
84 IDictionary Context { get; }
86 bool IsChildTransaction { get; }
88 bool IsRollbackOnlySet { get; }
90 TransactionMode TransactionMode { get; }
92 IsolationMode IsolationMode { get; }
94 bool DistributedTransaction { get; }
96 string Name { get; }
98 IResource[] Resources { get; }