Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate UI neutral MVVM types into a Csla.Mvvm project #1766

Open
rockfordlhotka opened this issue Aug 13, 2020 · 1 comment
Open

Consolidate UI neutral MVVM types into a Csla.Mvvm project #1766

rockfordlhotka opened this issue Aug 13, 2020 · 1 comment

Comments

@rockfordlhotka
Copy link
Member

As discussed here: #1765

There are a number of types (such as ViewModelBase) that are part of the Csla.Xaml and now Csla.Blazor packages/namespaces.

It would be cleaner and easier to work with if these types were in a Csla.Mvvm project, and those XAML/Blazor/etc. packages would only contain components specific to each UI framework.

@rockfordlhotka
Copy link
Member Author

My view on viewmodels (see what I did there?) has evolved over the years, and so has the way .NET enables things like async operations.

The consistent part of the way CSLA supports a viewmodel is that there should be a Model property that directly exposes the object graph (or a single domain object) for binding in the UI. This is because a CSLA domain object fully supports data binding in ways that would be really hard to translate through a viewmodel (the viewmodel would have to do everything that's already done by BusinessBase and the other base classes).

All that said, the various ViewModel and ViewModelBase types in Csla.Xaml, Csla.Xamarin, Csla.Blazor and probably other namespaces are very disorganized and have lots of inconsistencies and also lots of duplicate code.

It would be very nice at this point, to create a Csla.Mvvm namespace in the main CSLA project that has a ViewModel<T> type that does all the common behaviors that should exist across all UI frameworks.

Certainly the XAML UI frameworks have a bunch of framework-specific stuff in them, like support for commands. Hopefully that code can be in a subclass of Csla.Mvvm.ViewModel that leverages the common code and adds XAML-specific support.

I suspect that Blazor won't need a specific subclass, but I might be wrong.

Given that you can (and I do) now use DI with Windows Forms, I suspect the MVVM design pattern might work really well in a truly modern (reimagined) WinForms app scenario - but to me this is optional, because I don't imagine too many people are starting new projects with Windows Forms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant