Scenario mentioned in the DCR lesson :
Here we’ve chosen the name “AppExtension” for the class housing the extension properties. This class should be in the framework layer. We then create a page property in the framework’s class group of the app extension class. This property is then available to all application layers.The property points to a data page holding the extension values.The value is set for each application. Typically a data transform would be used, which is overridden in each application ruleset. In this case we are using a data transform called AppExtension.
It is shown in the lesson that the data trasform is overridden in the application ruleset. But this is still done in the fw layer class. Is this a good practice to save application layer rules in framework layer ?
It is good practice for this use case. The advantage of saving the Implementation Layer Data Transform in the FW Class is that this provides a single location for maintaining ALL the DCR Rules for the Application, making the application easier to maintain.
Shouldnt we restrict the FW layer to use only FW rulesets ? If we dont, then developers can save any rule in implementation ruleset and this would be difficult to maintain. Developers can mistakenly also create the rules in implementation rulesets in fw class.
Q: Shouldnt we restrict the FW layer to use only FW rulesets ? ... A: As a general guideline, Yes. However, this single use case presents an example where it may be more beneficial to override the restriction and allow DCR rules in the Imp Ruleset to be saved in this single FW class for maintenance purposes. All the other FW classes would still impose the FW Ruleset restriction. Since the App Ext class is used solely for DCR, it is unlikely that it would cause a problem.
If you don't save a data transform in the FW layer with the same name as the one in the Impl layer you won't be able to save the data page.The data transform in the FW layer can be empty as it is never used at runtime.