Rules for delete

Rules for delete

Old forum URL:

Alexey posted on Monday, March 26, 2012


Good day

Learn CSLA, developing an small project.

I have a company and the person objects.

In humans, one company, the company has a few people.


How do I make a rule that allows you to remove the company that are not referenced from the people and does not allow if the links are?


JonnyBee replied on Monday, March 26, 2012

There's 2 kinds of delete:

Immediate Deletion (only takes an Id in) and should return an Exception if delete is not possible.
                                      IE, Implement the check in DataPortal_Delete or use Refernetial Integrity in the database.

Deferred Deletion (an object is loaded, marked as deleted but actual delete does not happen until Save is called). 
Here you can create an AuthorizationRule that will accept the object and check if object has "children").

Copyright (c) Marimer LLC