Hi folks,
I'm using CRM 2015 and SDK 7.1.1.
Whent I use the CRMServiceContext for update and entity I receive this exception:
{"The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter
http://schemas.microsoft.com/xrm/2011/Contracts/Services:request. The InnerException message was 'Error in line 1 position 13185. Element 'http://schemas.datacontract.org/2004/07/System.Collections.Generic:value'
contains data from a type that maps to the name 'http://schemas.microsoft.com/xrm/7.1/Contracts:ConcurrencyBehavior'. The deserializer has no knowledge of any type that maps to this name. Consider changing the implementation of the ResolveName method on your
DataContractResolver to return a non-null value for name 'ConcurrencyBehavior' and namespace 'http://schemas.microsoft.com/xrm/7.1/Contracts'.'. Please see InnerException for more details."}
I use this code:
Uri organizationUri = new Uri("http://idefix/Standard/XRMServices/2011/Organization.svc");
Uri homeRealmUri = null;
System.ServiceModel.Description.ClientCredentials credentials = new System.ServiceModel.Description.ClientCredentials();
OrganizationServiceProxy orgProxy = new OrganizationServiceProxy(organizationUri, homeRealmUri, credentials, null);
orgProxy.EnableProxyTypes();
IOrganizationService _service = (IOrganizationService)orgProxy;
CRM.Model.CRMServiceContext ctx = new CRM.Model.CRMServiceContext(orgProxy);
CRM.Model.Contact ct = ctx.ContactSet.Where(c => c.LastName == "Ultimo nome").FirstOrDefault();
ct.JobTitle = "Modifca CTX";
ctx.UpdateObject(ct);
ctx.SaveChanges();
I use the context for create a new contact all work fine. Only update return me the exception
Thanks for any suggestion
LSo
LSo Lorenzo Soncini Trento TN - Italy