2
我試圖在域級別使用TransactionScope
,所以我可以跨越(可能)在多個存儲庫上操作數據,但將所有數據保存在同一個事務中。實體框架:TransactionScope有一個不同的IsolationLevel
我有以下保存方法:
public void Save(MyEntity source)
{
using (var scope = new TransactionScope())
{
var context = new MyEFEntities(environment.ConnectionString);
this.Repository.Add(source.ToDbMyEntity(), context);
context.SaveChanges();
scope.Complete();
}
}
,但我得到的.SaveChanges()
以下錯誤:
爲的TransactionScope指定的交易具有比請求的值不同 的IsolationLevel範圍。參數名稱: transactionOptions.IsolationLevel
這是什麼原因造成的?
你能告訴我你的數據庫當前的'隔離級別? http://stackoverflow.com/questions/1038113/how-to-find-current-transaction-level – Alireza