, - , ( ). , , EntityFramework.Extended:
db.Contact.Update(C => c.MemberId == 13, c => new Contact { Flag = 0 });
UPDATE Contact SET Flag = 0 WHERE MemberId = 13, , .
, . , "TransactionScope ( ).
, (ReadCommitted).
[EDIT]
Chris' , . , TransactionScope:
using (var db = new myEntities())
{
Console.WriteLine($"Isolation level outside TransactionScope = {db.Database.SqlQuery(typeof(string), selectIsolationLevel).Cast<string>().First()}");
}
using (var scope =
new TransactionScope(TransactionScopeOption.RequiresNew,
new TransactionOptions() { IsolationLevel = IsolationLevel.ReadUncommitted }))
{
Console.WriteLine($"Isolation level inside TransactionScope = {db.Database.SqlQuery(typeof(string), selectIsolationLevel).Cast<string>().First()}");
using (myEntities db = new myEntities ())
{
var data = from _Contact in db.Contact where _Contact.MemberId == 13 select _Contact;
for (var item I data)
item.Flag = 0;
db.SaveChanges();
}
scope.Complete();
}
( ), , Profiler , - ( GO s):
BEGIN TRANSACTION
SELECT <all columns> FROM Contact
exec sp_reset_connection
exec sp_executesql N'UPDATE Contact
SET [Flag] = @0
WHERE ([Contact] = @1)
',N'@0 nvarchar(1000),@1 int',@0=N'1',@1=1
COMMIT
:
, ( ).
.
, ( , -, ..), , .