Windows Phone 7 Developer Launch - Learn More

System.Transactions

There are 1 entries for the tag System.Transactions

LINQ to SQL: Reusing DataContext

I have been working on a project which uses a data access layer (DAL) to wrap some LINQ to SQL calls to the database. While I've played with LINQ to SQL a bit, this was my first time working on a production application. So as I wrote some of the business logic I wrapped some updates in a transaction (as any good database dev would do). Here's pretty much what it looked like:public void Swap(Product x, Product y){ x.DisplayIndex += y.DisplayIndex; y.DisplayIndex = x.DisplayIndex - y.DisplayIndex; x.DisplayIndex -= y.DisplayIndex; using( System.Transactions.TransactionScope txCtx = new System.Transactions.TransactionScope() )...

 

 

Copyright © Mark J. Miller