klemmchr / MvvmBlazor

A lightweight Blazor Mvvm Library
MIT License
246 stars 50 forks source link

Switch to CommunityToolkit.Mvvm #116

Open alikoli opened 2 years ago

alikoli commented 2 years ago

Feature description

Right now all the code generators are written from scratch. As version 8 of CommunityToolkit.Mvvm is oficialy released it would be great to use it. We could use NotifyPropertyChangedFor, mesaging, and other goodnes which is going to come in future releases.

Code sample

  1. Necessary change in ViewModelBase:
[INotifyPropertyChanged]
public abstract partial class ViewModelBase
{

and removal of INotifyPropertyChanged stuff as CommunityToolkit.Mvvm does it for us.

  1. There is a need to change Set to SetProperty (so it introduces breaking change)
  2. [Notify] must be changed to [ObservableProperty]

I created working repo: https://github.com/alikoli/MvvmBlazor-with-CommunityToolkit.Mvvm

No response

klemmchr commented 2 years ago

Thanks for the heads up, I already had a look at the release and I'm planning to implement this in the next major version. However, this will need a bigger refactoring of the whole library than just changing out some classes. The community toolkit has way more features than this library so they would need to be supported first.

Sen-Gupta commented 2 years ago

Bringing Community Toolkit is akin to adding firepower to this.

I liked your implementation and with community toolkit baked in, it just can't get better!