1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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
;
22 public enum TransactionStatus
32 /// Represents the contract for a transaction.
34 public interface ITransaction
37 /// Starts the transaction. Implementors
38 /// should activate the apropriate resources
39 /// in order to start the underlying transaction
44 /// Succeed the transaction, persisting the
50 /// Cancels the transaction, rolling back the
56 /// Signals that this transaction can only be rolledback.
57 /// This is used when the transaction is not being managed by
60 void SetRollbackOnly();
63 /// Returns the current transaction status.
65 TransactionStatus Status { get; }
68 /// Register a participant on the transaction.
70 /// <param name="resource"></param>
71 void Enlist(IResource resource
);
74 /// Registers a synchronization object that will be
75 /// invoked prior and after the transaction completion
76 /// (commit or rollback)
78 /// <param name="synchronization"></param>
79 void RegisterSynchronization(ISynchronization synchronization
);
82 /// Transaction context. Can be used by applications.
84 IDictionary Context { get; }
86 bool IsChildTransaction { get; }
88 bool IsRollbackOnlySet { get; }
90 TransactionMode TransactionMode { get; }
92 IsolationMode IsolationMode { get; }
94 bool DistributedTransaction { get; }
98 IResource
[] Resources { get; }