I am using entity transaction in my project but somehow it is not working. It is also not giving any error. Pls help me. I am giving some code ...
EntityConnection objEntityCon = new EntityConnection(CommonDividentBL.GetEntityConnectionString());
objEntityCon.Open();
// Begin Transaction
EntityTransaction entityTransaction = objEntityCon.BeginTransaction();
try
{
开发者_Python百科 //database saving code
entityTransaction.Commit();
objEntityCon.Close();
}
catch (Exception ex)
{
entityTransaction.Rollback();
}
Are you sure that it doesn't have any error? Tried in the debugger?
Your code catches any exceptions, rolls back your changes but does not notify you of the exception (eg by re-throwing or logging or etc)
精彩评论