Added DictionaryAdapter.build.
[castle.git] / Services / Transaction / Castle.Services.Transaction / ITransactionManager.cs
blobc26670028dbaf7e8eb67451b095bd52273f69e40
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 public delegate void TransactionCreationInfoDelegate(ITransaction transaction, TransactionMode transactionMode, IsolationMode isolationMode, bool distributedTransaction);
19 public delegate void TransactionDelegate(ITransaction transaction);
21 /// <summary>
22 /// Manages the creation and disposal of <see cref="ITransaction"/> instances.
23 /// </summary>
24 public interface ITransactionManager
26 /// <summary>
27 /// Raised when a top level transaction was created
28 /// </summary>
29 event TransactionCreationInfoDelegate TransactionCreated;
31 /// <summary>
32 /// Raised when a child transaction was created
33 /// </summary>
34 event TransactionCreationInfoDelegate ChildTransactionCreated;
36 /// <summary>
37 /// Raised when the transaction was committed successfully
38 /// </summary>
39 event TransactionDelegate TransactionCommitted;
41 /// <summary>
42 /// Raised when the transaction was rolledback successfully
43 /// </summary>
44 event TransactionDelegate TransactionRolledback;
46 /// <summary>
47 /// Raised when the transaction was disposed
48 /// </summary>
49 event TransactionDelegate TransactionDisposed;
51 /// <summary>
52 /// Creates a transaction.
53 /// </summary>
54 /// <param name="transactionMode">The transaction mode.</param>
55 /// <param name="isolationMode">The isolation mode.</param>
56 /// <returns></returns>
57 ITransaction CreateTransaction(TransactionMode transactionMode, IsolationMode isolationMode);
59 /// <summary>
60 /// Creates a transaction.
61 /// </summary>
62 /// <param name="transactionMode">The transaction mode.</param>
63 /// <param name="isolationMode">The isolation mode.</param>
64 /// <param name="distributedTransaction">if set to <c>true</c>, the TM will create a distributed transaction.</param>
65 /// <returns></returns>
66 ITransaction CreateTransaction(TransactionMode transactionMode, IsolationMode isolationMode, bool distributedTransaction);
68 /// <summary>
69 /// Returns the current <see cref="ITransaction"/>.
70 /// The transaction manager will probably need to
71 /// hold the created transaction in the thread or in
72 /// some sort of context.
73 /// </summary>
74 ITransaction CurrentTransaction { get; }
76 /// <summary>
77 /// Should guarantee the correct disposal of transaction
78 /// resources.
79 /// </summary>
80 /// <param name="transaction"></param>
81 void Dispose(ITransaction transaction);