I am trying to delete a record in a many-many table that has a Unique index on it. Therefor if a component is being added to a list the order has to be incremented by one or the back-end wont allow it to be saved to the DB.
My problem comes in when I delete one of these components in the list I am also modifying any components with and Order higher than it as to not have a gap in the order of these components.
Scenario:
The many to many table is populated with 5 components with unique index's as are the componentId's unique. The components entityAspect is set to deleted (No save has taken place yet)
I delete the third component thus component 4 & 5 will have there index reduced by 1 each so that the new index will be 1234 and not 1245. This is done is JS and once this is done I then call my service which saves all the changes.
I have also tried to overwrite the saveMap.
protected override Dictionary<Type, List<EntityInfo>> BeforeSaveEntities(Dictionary<Type, List<EntityInfo>> saveMap)
{
saveMap[typeof(ManyToManyBdo)] = saveMap[typeof(ManyToManyBdo)].OrderBy(info => info.EntityState).ToList();
return base.BeforeSaveEntities(saveMap);
}
This doesn't seem to change the way breeze executes though.