1

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.

phil652
  • 1,484
  • 1
  • 23
  • 48
Andrew
  • 11
  • 4
  • The Link below will explain in detail the error with an explanation of how it can be potentially fixed. I found that a DB trigger isn't the best fit for me so just removed the index. if you find something better please post on this thread as I would like to have a more secure way of handling the data. https://github.com/Breeze/breeze.js/issues/89 – Andrew Apr 24 '15 at 08:56

0 Answers0