Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

CrmOrganizationServiceContext generated classes not clearing CrmEntityReference properties on UpdateObject

$
0
0

Hi,

I'm using the early bound classes generated with the /codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization,Microsoft.Xrm.Client.CodeGeneration" flag set with the CrmSvcUtil.exe.

The issue I'm having is that when I update any entity's reference property to null and call UpdateObject() followed by SaveChanges(), it fails clear the referenced entity.

E.g.

var connection = new CrmConnection("XRM");
var context = new FrodoCorpContext(connection); // this extends from CrmOrganizationServiceContext and uses CrmEntity and CrmEntityReference
var account = new Account(); account.Id = existingAccountId; //a valid existing Guid which exists with a parent account set
account.Name = "Updated Account Name"; account.ParentAccountId = null; // this should clear the parent account which is already set in CRM context.Attach(account); context.UpdateObject(account); context.SaveChange();


This completes without errors. The name of the account will be updated however the ParentAccount remains set and has not cleared.

Any ideas?

Thanks!


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>