I have two entities in my database that are responsible to control the application access. The structure of "levels" is hierarchical and a specific level never has more rights than your parent.
AccessLevel
----------------
AccessLevelID
Name
AccessLevelParentID
AccessLevelRight
----------------
AccessLevelID
ActionID
When I remove a right from a parent, I need to remove this right (if exist) for all children of this level.
So, I need to create a kind of validation to assert this business logic.
I thought to do this creating a validation in an entity partial class:
public override void Validate(IdeaBlade.Validation.VerifierResultCollection validationErrors)
But, in this validation, I need to execute a query and manipulate some data. I don't have an entity manager in that scope.
I can solve my problem creating a trigger in the database, but I don't want to do this.
How can I do it?