Transaction management in Spring.net provides following main benefits as custom software development companies :
- Provides a straightforward API for programming model such as ADO.NET, Enterprise Services and System. Transactions, and NHibernate.
- Provide declarative transaction management using any of the data access technologies
- Provides API which is very easy to use and applicable on programmatic transaction management
- Integrates with high level persistence integration APIs such as AdoTemplate.
Cosider following interface which is defined by transaction. It is called
Spring.Transaction.IPlatformTransactionManager interface, shown below:
public interface IPlatformTransactionManager {
ITransactionStatusGetTransaction(ITransactionDefinition
definition );
void Commit( ITransactionStatustransactionStatus );
void Rollback( ITransactionStatustransactionStatus );
}
IPlatformTransactionManager is an interface and its implementations can be defined by any other object in the IoC container. Consider following implementations:
- AdoPlatformTransactionManager: Transaction based on local ADO.NET
- ServiceDomainPlatformTransactionManager: like distributed transaction manager from Enterprise Services
- TxScopePlatformTransactionManager:It is local/distributed transaction manager which belongs toSystem.Transactions.
- HibernatePlatformTransactionManager:It is local transaction manager which is use with NHibernate or ADO.NET/NHibernate data access operations.
The following API are made. For the AdoPlatformTransactionManager,
Transaction.Begin(), Commit(), Rollback(). ServiceDomainPlatformTransactionManager uses the'Services without Components' update so that your objects do not need to inherit fromServicedComponent or directly call the Enterprise Services API ServiceDomain.Enter(), Leave;ContextUtil.SetAbort()TxScopePlatformTransactionManager calls; new TransactionScope(); .Complete(),Dispose(), Transaction.Current.Rollback(). Configuration properties for each transaction manager are specific tothe data access technology used. Refer to the API docs for comprehensive information but the examples shouldgive you a good basis for getting started. The HibernatePlatformTransactionManager is described more in thefollowing section.
The GetTransaction(..) method returns a ITransactionStatus object and it is depending on aITransactionDefinition parameters. The returned ITransactionStatus may represent a new or existingtransaction (if there was a matching transaction in the current call stack - with the implication being that ITransactionStatus is associated with a logical thread of execution.
The ITransactionDefinition interface is described by software development companies as follow:
- Isolation: the degree of isolation means the transaction is reading data of another transaction. So if another transaction leave in uncommitted phase then current transaction has data which is not exist.
- Propagation: Most of code executed within a transaction boundary will run in that transaction‘s scope. However, there are several possible options there to specify behavior if a transactional method is executed when a transaction context already exists like, simply continue running in the existing transaction or suspending the execution of existing transaction and creating another new transaction.
- Timeout: Amount of time taken by transaction before timeout. It is automatically being rolled back by the underlying transaction infrastructure.
- Read-only status: Any data cannot be modified by a read-only transaction. This type of transaction is very much useful for optimization purpose in some area (Especially while using NHibernate).
Nice post, Thanks for sharing Get more update at
ReplyDelete.Net Online Training Bangalore