DHXEventsHelper.Update error

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

Hi,
thanks for reporting, we’ll investigate the problem

no problem you’re more than welcom :wink:

Found another problem
Basically the DataAction method returs this: <data><action type="updated" sid="24,24" tid=""></action></data>
instead of this:
It happens on a second update, first update works just fine as I mentioned earlier (after I have applied my fix).

  • Insert fine
  • First update fine
  • Second Update, Data Action returns that wrong data.