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

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -