New Posts New Posts RSS Feed: isolation level
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

isolation level

 Post Reply Post Reply
Author
BillG View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 05-Dec-2007
Location: Monroe, MI
Posts: 233
Post Options Post Options   Quote BillG Quote  Post ReplyReply Direct Link To This Post Topic: isolation level
    Posted: 16-Feb-2011 at 12:08pm
Can you provide an example of setting the isolation level?
 
Bascially what I need is I have a method that grabs the next invoice # from a table, increments it and saves it back to the table. I want the above to be part of the same transaction and I want to block other users from grabbing a number until another user has written back the next number.
 
Bill
 
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 16-Feb-2011 at 3:47pm
Hi BillG;

Here's an example. 1 for saving, 1 for querying.

TransactionSettings settings = new TransactionSettings(System.Transactions.IsolationLevel.ReadCommitted, 
                                                                                         new TimeSpan(0, 1, 0));

mgr.DefaultSaveOptions.TransactionSettings = settings;

TransactionSettings settings2 = new TransactionSettings(System.Transactions.IsolationLevel.Serializable, 
                                                                                         new TimeSpan(0, 1, 0));

QueryStrategy qs = new QueryStrategy(QueryStrategy.Normal, settings2);
mgr.DefaultQueryStrategy = qs;

And the link to our DRC that briefly talks about this. 


Hope this helps.


Edited by DenisK - 16-Feb-2011 at 3:47pm
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down