Business Delete Rules

When you create a model – deletion of objects is seldom on top of your mind. But sooner or later users are going to want to remove objects from the system executing your model.

The main problem with deletion is the what business rules that deletion should adhere to. The technical rules the deletion adheres to are covered by aggregation and the deleteaction as described earlier here.

We have now also added the IBusinessDeleteService that works like this; on every associationend you can set one of four values: NotDecided, MustBeEmpty, NeedNotBeEmptyButWarn, NeedNotBeEmptyNoWarning. The default value is NotDecided.

Now – what you should do with this meta information is up to you. You are free to implement your own flavor of the IBusinessDeleteService or you can just implement the IBusinessDeleteService.OnInformTheUser event  on the standard implementation.

WECPOF implements this event and shows a dialog to the user.

image

When you have the BusinessDeleteRule set to NeedNotBeEmptyButWarn you will get messages like these:

image

image

If you have BusinessDeleteRule set to NotDecided you get a message like this:

image

If you have the BusinessDeleteRule set to MustBeEmpty you get this:

image

Delete constraints

Further more you may have explicit business rules that controls if it is ok to delete an object or not – you can now handle these as normal class constraints. Constraints has been extended with an attribute IsDeleteConstraint – if this is set the default implementation of the IBusinessDeleteService will call the OnInformUser event with the message constraint as a parameter. WECPOF uses this to show a dialog to the user and stopping the delete until the constraint-break is fixed.

This new service helps you to feel in control and good about deletion. It will not automatically solve all your delete issues – but we believe that it will enable you to easily solve them all as they are needed. Agile so to speak.

This entry was posted in Declarative, Modlr, WECPOF. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*