You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ObservableObjectAttribute is very powerful in cutting a lot of boiler plate code and 'injecting' INPC stuff into a class.
I was wondering if we could take it a step further and wrap all of the source's virtual properties as well.
This is super useful when the entities are pre-existing or are coming from a 3rd party library. Rewriting all models with their properties is super tedious.
API breakdown
publicclassPersonModel{publicvirtualstringName{get;set;}publicvirtualintAge{get;set;}publicvirtualstringAddress{get;set;}}[ObservableObject(RegenerateProperties=true,ExcludeProperties="Name,Address")]publicpartialclassPersonViewModel:Model{}Generated:publicpartialclassPersonViewModel: Model,INotifyPropertyChanged,INotifyPropertyChanging{// Everything that's already generated todaypublicoverrideintAge{
get =>_Age;set{if(!EqualityComparer<int>.Default.Equals(_Age,value)){OnAgeChanging(value);OnAgeChanging(default,value);OnPropertyChanging(...);_Age=value;OnAgeChanged(value);OnAgeChanged(default,value);OnPropertyChanged(...);}}}}partialvoidOnAgeChanging(intvalue);
...}
Overview
The
ObservableObjectAttribute
is very powerful in cutting a lot of boiler plate code and 'injecting' INPC stuff into a class.I was wondering if we could take it a step further and wrap all of the source's virtual properties as well.
This is super useful when the entities are pre-existing or are coming from a 3rd party library. Rewriting all models with their properties is super tedious.
API breakdown
Usage example
Breaking change?
No
Alternatives
Castle.Core
Additional context
No response
Help us help you
Yes, I'd like to be assigned to work on this item
The text was updated successfully, but these errors were encountered: