New Posts New Posts RSS Feed: Using TransactionScope for volatile data
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Using TransactionScope for volatile data

 Post Reply Post Reply
Author
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Topic: Using TransactionScope for volatile data
    Posted: 11-Nov-2011 at 10:02am
By default DevForce uses a TransactionScope with an IsolationLevel of ReadCommitted for every query or save.  You can change this default by changing the TransactionSettings.Default or setting the TransactionSettings on the QueryStrategy and/or SaveOptions.   For example to change the default:
 
  TransactionSettings.Default = new TransactionSettings(IsolationLevel.ReadCommitted, TimeSpan.FromSeconds(30), true);
Back to Top
JohnBloom View Drop Down
Groupie
Groupie
Avatar

Joined: 30-Nov-2010
Location: Topeka, KS
Posts: 95
Post Options Post Options   Quote JohnBloom Quote  Post ReplyReply Direct Link To This Post Posted: 10-Nov-2011 at 10:25am

We have a Silverlight app and have a process on the server that grabs a number from the database and increments the number by one afterwards. We need to make sure that the number is never grabbed at the same time producing duplicate records. There is also logic that tells which number field in the entity to increment, so auto incrementing fields won’t work. In our previous product we use SQL Transactions and they worked great.

I found an implementation for Transactions in Entity Framework here:

http://geekswithblogs.net/SudheersBlog/archive/2010/04/11/139193.aspx

I there are lots of options transactionscope:

http://enggtech.wordpress.com/2009/10/16/transactionscope-class-system-transactions/

I have tried many combinations of these settings and I always get the same error:

“The transaction specified for TransactionScope has a different IsolationLevel than the value requested for the scope.  Parameter name: transactionOptions.IsolationLevel”

Does anybody have an example of doing transactions in Devforce that are outside the CRUD model?

-John Bloom
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down