This repository has been archived by the owner on May 1, 2024. It is now read-only.
v1.1.0
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
toMvvmComponentBase
. This base class provides basic functionality but does not expose any lifecycle methods. - Components need to inherit from
MvvmComponentBase<T>
whereT
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 bindingBind(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()
forIApplicationBuilder
orIComponentsApplicationBuilder
. - Rename
OnInit()
toOnInitialized()
in your view models. - Rename
OnInitAsync()
toOnInitializedAsync()
in your view models., - Add the parameter
bool firstRender
toOnAfterRender()
andOnAfterRenderAsync()
in your view models.
-ViewModelBase.Cleanup()
is gone. Instead, overrideViewModelBase.Dispose(bool disposing)
.
Additions
ViewModelBase
now also exposesSetParametersAsync(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.