Last post Aug 16, 2016 03:11 AM by Chris Zhao
Aug 05, 2016 02:16 PM|rajemessage|LINK
i am using entitiy framwok and transactionscop with required transaction parameter.
all my quires are taking serialized isolation , please suggest where i have gone worng and please suggest how to change to read commited.
Aug 06, 2016 07:00 AM|Chris Zhao|LINK
The behavior of READ COMMITTED depends on the setting of the READ_COMMITTED_SNAPSHOT database option:
If READ_COMMITTED_SNAPSHOT is set to OFF (the default), the Database Engine uses shared locks to prevent other transactions from modifying rows while the current transaction is running a read operation. The shared locks also block the statement from reading
rows modified by other transactions until the other transaction is completed. The shared lock type determines when it will be released. Row locks are released before the next row is processed. Page locks are released when the next page is read, and table locks
are released when the statement finishes.
SET TRANSACTION ISOLATION LEVEL (Transact-SQL)
How do I set the transaction isolation level when connecting to a SQL Server database
Aug 06, 2016 10:25 AM|rajemessage|LINK
i asked some thing else , it was about serialized isolation level, i wanted to know is entitiy frame work or transaction scopes are picking up automatically
or by default ( serialized ).
if yes then pls tel me the good way to making it read commited.
Aug 16, 2016 03:11 AM|Chris Zhao|LINK
Entity Framework automatically wraps all the queries made by the DbContext.SaveChanges() method in a single explicit database transaction, therefore ensuring that all the changes applied to the context are either committed or rolled-back in full.
It will use whatever default transaction isolation level the database engine has been configured to use (READ COMMITTED by default for SQL Server).
You can override EF's default behaviour and control the database transaction scope and isolation level.
using (var context = new MyDbContext(ConnectionString))
using (var transaction = context.BeginTransaction(IsolationLevel.RepeatableRead))