我希望通过以下代码在EF中创建OptimisticConcurrencyException;但它不会导致异常!
int device101 = SqlAggregateTestData.DeviceId101;
IfaEntities context1 = new IfaEntities();
IfaEntities context2 = new IfaEntities();
var device1 = context1.Devices.Find(device101);
context1.Entry(device1).State=EntityState.Modified;
device1.Name = "sss";
var device2 = context2.Devices.Find(device101);
context2.Entry(device2).State=EntityState.Modified;
device2.Name = "ss22222s";
context2.SaveChanges();
context1.SaveChanges();
我希望这可以针对OptimisticConcurrencyException测试我的EF代码库。