Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

v1.1.0

Compare
Choose a tag to compare
@klemmchr klemmchr released this 23 Sep 20:44
a12f4b4

This update brings compatibility with .NET Core 3.0 and introduces breaking changes (as .NET Core did).

Breaking changes

  • The name of the component base class has been changed from ComponentBaseMvvm to MvvmComponentBase. This base class provides basic functionality but does not expose any lifecycle methods.
  • Components need to inherit from MvvmComponentBase<T> where T is the type of the view model that should be set as the binding context. It will be resolved from the DI container automatically. Use @inherits MvvmComponentBase<T> in your component.
  • Remove any view model injections in your component where they are set as a binding context. Instead switch to the new component base class mentioned above.
  • Remove the method SetBindingContext() from your components. The binding context is now automatically resolved and set for you.
  • Bindings on the binding context now support LINQ expressions for the binding context. Given a view model that has the property Forecasts you can use this code to generate a binding Bind(x => x.Forecasts).
  • Remove the layout directive. The base class LayoutComponentBaseMvvm has been deleted as there is no further need for it.
  • The own implementation of ObservableCollection has been removed since it's implementation isn't working any more and it is out of scope for a lightweight MVVM solution.
  • You now need to register the library in your DI container via AddMvvm().
  • You also need to register the library in your Application Builder. Use UseMvvm() for IApplicationBuilder or IComponentsApplicationBuilder.
  • Rename OnInit() to OnInitialized() in your view models.
  • Rename OnInitAsync() to OnInitializedAsync() in your view models.,
  • Add the parameter bool firstRender to OnAfterRender() and OnAfterRenderAsync() in your view models.
    -ViewModelBase.Cleanup() is gone. Instead, override ViewModelBase.Dispose(bool disposing).

Additions

  • ViewModelBase now also exposes SetParametersAsync(ParameterView parameters). You can now use it from your view models.

Bugfixes

  • StateHasChanged() was not working. Now it will correctly rerender the component.

Misc

  • The examples now contain some explanation and a Clock demonstration to illustrate how easy background updating properties work.