Possible bug using EF and the DHXEventsHelper.Update method ?
Basically in my new project (MVC 4, EF 4.4.0.0) when I save this way:
var eventToUpdate = data.Events.SingleOrDefault(ev => ev.id == action.SourceId);
DHXEventsHelper.Update(eventToUpdate, changedEvent, new List<string>() { "id" });
data.SaveChanges();
It throws this: “The EntityKey property can only be set when the current value of the property is null”
It seems it’s trying to set a new key, while it shouldn’t.
If I manually update the properties like this :
var eventToUpdate = data.Events.SingleOrDefault(ev => ev.id == action.SourceId);
eventToUpdate.IdType = changedEvent.IdType; //custom field
eventToUpdate.start_date = changedEvent.start_date;
eventToUpdate.end_date = changedEvent.end_date;
eventToUpdate.Approved = changedEvent.Approved;
data.SaveChanges();
This runs just fine
I’m using the .net scheduler v3.0
Not a huge problem for me, maybe someone else have a lot of data and prefer the helper way
thanks in advance