Nargzul
asked on
Use Isolation level in LINQ
I try to use isolation level with L2E, but I've this problem:
The transaction specified for TransactionScope has a different IsolationLevel than the value requested for the scope. Parameter name: transactionOptions.Isolati onLevel
And I dont understand why.
This error is displayed when I call my dedicated method:
The transaction specified for TransactionScope has a different IsolationLevel than the value requested for the scope. Parameter name: transactionOptions.Isolati
And I dont understand why.
This error is displayed when I call my dedicated method:
public static int insertDB(InsertDbDelegate methodThatWriteDB, IsolationLevel isoLevel, MasterPage senderPage)
{
int objectsAdded = 0;
try
{
using (var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions() { IsolationLevel = isoLevel }))
{
using (geststockEntities gse = new geststockEntities(cs_admin))
{
methodThatWriteDB(gse);
objectsAdded = gse.SaveChanges();
if (objectsAdded == 0) throw new Exception();
scope.Complete();
gse.Connection.Close();
addUserMessage(senderPage, "Insertion OK");
}
}
}
catch (Exception ex)
{
addErrorMessage(senderPage, "Error when connecting to the database." + ex.Message);
}
return objectsAdded;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
also check if it is related to your problem:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=325381&wa=wsignin1.0