I have a plugin that needs to create a bunch of entities, and does so using;
At the end of the plugin (pre-operation on Update, synchronous) I sometimes need to cancel the save operation. The only way I know how is to throw an exception, but if I do that my service.Create(Entity) does not get executed.
How do I force the service to execute the operations inside the plugin, and then cancel the save by throwing an exception?
EDIT: The code is;
var id = service.Create(newEntity); throw new Exception("Cancelled Save but created the new entity");
If I throw the exception, the entity does not get created. If I do not throw the exception, the entity does create. I need it to create and also throw the exception so that the save operation is cancelled.
Thanks for any pointers.