Xaf architecture and especially the model part is great. What it really teach us is how to parameterized our logic/behavior/code and store that parameter in the model in the form of attributes on already existing nodes or on rule nodes see Xaf Validation system or ConditionalEditorState system. eXpand has provided a similar architecture through its ModelArtifactState module.
But after you start using such “ruling” modules for some times the most “logical” question will come into your mind.
How I could define a uniform way of describing a behavior in terms of an interface and apply a ruling system upon it.
The above problem exactly is address by logic module. What it does ? First look at ILogicRule interface
So given the properties of the above interface the logic system expects you to provide
1. A LogicAttribute derived class so you can apply it above your domain object classes
2.A LogicRule derived class
3.a LogicRuleNodeWrapper, derived class so you can control the model
4.A LogicRulePermission derived class so you can control your behavior from the xaf security system
as you see all expected classes should implement the same interface such achieving polymorphism ..
So given that you have provided the above classes then Rule Logic system will attach to the events defined by the following contexts
and for the rule that are valid according to the ExecutionContextGroup and all other properties defined at I LogicRule interface it will provide a method within a controller to override and place your own logic for that spesific rule.
In the next post I ll speak about how I extended the logic module to create the conditional logic module. The logic module is exposed by eXpand.ExpressApp.Logic.dll assembly