c# - An error was reported while committing a database transaction but it could not be determined -
public class repository { private readonly unitofwork _uow; public repository() { _uow = new unitofwork(); } public void insertsummary(list<string> knownmodel,int batchid,int personid,int submittingorgid) { foreach (var src in knownmodel) { _uow.summaryrepo.insert(new sifuploadsummary { sessionid = sessionid, batchid = batchid, rifobject = src, successcount = 0, pcount = 0, ccount = 0, cecount=0, dcount = 0, ecount = 0, personid = personid, organizationid = submittingorgid, status = 1 loginid = username, createdate = datetime.now }); } _uow.summaryrepo.save();//here getting above error. } } while inserting records in table above code getting following exception
an error reported while committing database transaction not determined whether transaction succeeded or failed on database server. see inner exception , http://go.microsoft.com/fwlink/?linkid=313468 more information.the transaction operation cannot performed because there pending requests working on transaction.
how handle exception please me. error occurs not regularly.
here can use commitfailurehandler of entity frame work how use here using unit of work repository.
Comments
Post a Comment