Migrating to Csla 6 - Static permissions methods #3598
-
We're moving from Csla 5 to Csla 6, and I had already know the static DataPortal.Create/Fetch/Update/Delete were going way. We're going the route of creating a Factory instance object where the IDataPortal can be injected. One thing I hadn't expected though was this no longer compiling
It seems to want ApplicationContext now as the first parameter, which I understand why. I can move this method to our factory class and have it get ApplicationContext injected. (We already do that for factories but they just call the static method on the BO). My only (very minor) issue though is that it seems odd have the AuthAction in the factory to check permissions and the BO to setup the permissions b/c now its in two files. It was easier to find a mismatch that way. Is there another way this should be done now? Or is this more or less what we should be doing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Most apps I've built over the last several years have used a sort of MVVM approach, and the viewmodel is an instance that knows the type of the domain object (Model). Because of this, the viewmodel can ask for type-level rules like The rules should stay in the business domain class, absolutely! What's usually needed is an object that can be used by the UI to ask those questions - and the viewmodel (or similar) is that object. Another example (in XAML and Blazor) is the |
Beta Was this translation helpful? Give feedback.
Most apps I've built over the last several years have used a sort of MVVM approach, and the viewmodel is an instance that knows the type of the domain object (Model). Because of this, the viewmodel can ask for type-level rules like
CanExecuteObject
, and expose the result to the UI.The rules should stay in the business domain class, absolutely!
What's usually needed is an object that can be used by the UI to ask those questions - and the viewmodel (or similar) is that object.
Another example (in XAML and Blazor) is the
PropertyInfo
UI component, that answers those questions on a per-property basis.