Skip to main content

Posts

Showing posts from November, 2011

TRANSACTION implementation in LINQ

LINQ is become one of most popular. But Based on our business logic we need to Use Transaction in LINQ. LINQ Transaction is much more smart. You do not need to rollback. If it fail to complete any query it automatically rollback. To use transaction You have to add a .NET dll name  "System.Transaction" in reference of your application. . Now in your DataAccess Layer you can use like public void UpdateSaleDetailsTable(ESalesReturn aSalesReturn) { using(System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required)) { UpdateSaleDetailsTableData(aSalesReturn); UpdateSaleTable(aSalesReturn); UpdateCurrentProductTable(aSalesReturn); InsertIntoSalesReturnTable(aSalesReturn); scope.Complete(); } }