Hi,
I'm binding entities to a grid (Janus v3) and I want to persist each change (adding, deleting and changing) without any buttons just when the user changes the row.
I managed the delete with the EntityRemoving Event.
void myEntityCollection_EntityRemoving(object sender, CancelableCollectionChangedEventArgs e)
{
int delId = ((myEntity) e.InvolvedEntity).ID;
IPredicateExpression delFilter = new PredicateExpression((myEntityFields.ID == delId));
myEntityCollection.DeleteMulti(delFilter);
}
But it only works, if I leave myEntityCollection.AllowRemove to false. If I set it to true, I get an Exception.
The edit I have achieved using the CurrentItemChanged event of the binding source. In that event I test the myEntityCollection.DirtyEntities property and call Save for each entity in that list.
This also works for new entities but I'm having doubts whether this is a good way. I thought the new event EntityAdded would be the right place for the adding, but calling SaveMulti in it doesn't work. The added entity is still empty in that event.
Could you please enlighten me what would be the right way for this scenario.
Thanks in advance