sql - TransactionScope per function for WCF -
i have 2 functions wcf, both using:
using (transactionscope transactionscope = new transactionscope(transactionscopeoption.required, new transactionoptions { isolationlevel = isolationlevel.serializable })) { // code here }
if call both functions simultaneously, 1 function always wait until other 1 finished? need data consistency.
i use sql server 2008 , entity framework 5.0.
that depends on you're doing inside transaction.
if reading data inside transactions, there no locking conflicts , transactions won't wait each other.
if 1 transaction reading , other writing same range of data, have wait each other. same applies situation when both write same range of data.
serializable transaction isolation level restrictive of isolation levels. can check more here on microsoft technet: http://technet.microsoft.com/en-us/library/ms173763.aspx
having said that, can still control locking on each individual statement level using locking hints. can read more here: http://technet.microsoft.com/en-us/library/ms189857(v=sql.105).aspx
Comments
Post a Comment