Fixing an issue with output parameters that are of type IntPtr
[castle.git] / Services / Transaction / Castle.Services.Transaction / ITransactionManager.cs
blob4ea5b49ff5ed3bd42a0d8a0cab9d19136232c4b3
1 // Copyright 2004-2008 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 public delegate void TransactionErrorDelegate(ITransaction transaction, TransactionException transactionError);
23 /// <summary>
24 /// Manages the creation and disposal of <see cref="ITransaction"/> instances.
25 /// </summary>
26 public interface ITransactionManager
28 /// <summary>
29 /// Raised when a top level transaction was created
30 /// </summary>
31 event TransactionCreationInfoDelegate TransactionCreated;
33 /// <summary>
34 /// Raised when a child transaction was created
35 /// </summary>
36 event TransactionCreationInfoDelegate ChildTransactionCreated;
38 /// <summary>
39 /// Raised when the transaction was committed successfully
40 /// </summary>
41 event TransactionDelegate TransactionCommitted;
43 /// <summary>
44 /// Raised when the transaction was rolledback successfully
45 /// </summary>
46 event TransactionDelegate TransactionRolledback;
48 /// <summary>
49 /// Raised when the transaction was disposed
50 /// </summary>
51 event TransactionDelegate TransactionDisposed;
53 /// <summary>
54 /// Raised when the transaction has failed on commit/rollback
55 /// </summary>
56 event TransactionErrorDelegate TransactionFailed;
58 /// <summary>
59 /// Creates a transaction.
60 /// </summary>
61 /// <param name="transactionMode">The transaction mode.</param>
62 /// <param name="isolationMode">The isolation mode.</param>
63 /// <returns></returns>
64 ITransaction CreateTransaction(TransactionMode transactionMode, IsolationMode isolationMode);
66 /// <summary>
67 /// Creates a transaction.
68 /// </summary>
69 /// <param name="transactionMode">The transaction mode.</param>
70 /// <param name="isolationMode">The isolation mode.</param>
71 /// <param name="distributedTransaction">if set to <c>true</c>, the TM will create a distributed transaction.</param>
72 /// <returns></returns>
73 ITransaction CreateTransaction(TransactionMode transactionMode, IsolationMode isolationMode, bool distributedTransaction);
75 /// <summary>
76 /// Returns the current <see cref="ITransaction"/>.
77 /// The transaction manager will probably need to
78 /// hold the created transaction in the thread or in
79 /// some sort of context.
80 /// </summary>
81 ITransaction CurrentTransaction { get; }
83 /// <summary>
84 /// Should guarantee the correct disposal of transaction
85 /// resources.
86 /// </summary>
87 /// <param name="transaction"></param>
88 void Dispose(ITransaction transaction);