c# - updates an entity flush is child entity in EF -


when save existing entity in project, if don't include child on dbset, lose previous value. can't figure out what's wrong project, not have in others projects.

some code :

var quoterequest = _session.set<quoterequest>()                 .include(x => x.quoterequestinvites)                 .include(x => x.quoterequestinvites.select(y => y.selectedservice))                 .include(x => x.quoterequestinvites.select(y => y.selectedservice).select(z => z.service))                 .include(x => x.quoterequestinvites.select(y => y.provider))                 .include(x => x.district)                 .include(x => x.city)                 .firstordefault(x => x.id == quoterequestid);  if (quoterequest == null)     return request.createresponse(httpstatuscode.notfound);  foreach (var invite in quoterequest.quoterequestinvites) {     if (invite.token == guid.empty)     {         _logger.warn(invite, "empty token changed invite " + invite.id);                     invite.token = guid.newguid();                     _session.commit();     } }  _providermailerservice.processinvites(quoterequest); _customermailerservice.processnotification(quoterequest);  _session.attach(administrator); quoterequest.approvaldate = datetime.utcnow; quoterequest.approvedby = administrator; _session.commit(); 

the problem there somewhere in project missing includes, lose data.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -