I'm trying to use a TransactionScope
at Domain level, so I can manipulate data across (potentially) several repositories, yet save all that in the same transaction.
I have the following save method:
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();
}
}
But I get the following error on the .SaveChanges()
:
The transaction specified for TransactionScope has a different IsolationLevel than the value requested for the scope. Parameter name: transactionOptions.IsolationLevel
What's causing this?