We are able to create new entities without any issues, but updating an existing entity in a plugin this does not appear to be working. This is for CRM 2011.
var crmContext = new CustomCrmContext(service);
var contact = crmContext.Contact.FirstOrDefault(c=>c.Id == targetEntity.Id);
contact.new_CustomField = "Updated";
crmContext.SaveChanges();
You have to mark the object as modified in order to get it submitted to the server. See OrganizationServiceContext.UpdateObject (Entity)
You should add
crmContext.UpdateObject(contact);
beforecrmContext.SaveChanges();
LINQ is fine, just create the new object or list and loop the list in the linq and update:
No need to download the whole Contact record if you already have the Id and you just need to update a field or two. You also don't need the OrganizationServiceContext - just the Service. Try something like:
This will save the roundtrip of querying for the contact first.