BondAddict
BondAddict
CC#
Created by BondAddict on 12/26/2024 in #help
Does anyone have advice on dealing with Blazor not being reactive out of the box?
I have an application that I inherited at work that has some large models with lots of nested properties and collections. I've tried implementing Fody/PropertyChange.Fody and I'm currently looking at ReactiveUI/ReactiveUI.Fody/ReactiveUI.SourceGenerator. ReactiveUI looks to be a good way to go, but their documentation is incredibly confusing. My main issue is that I need to be notified anytime an item in any of my collections is changed (edit). I've already swapped all my List<T> properties to use ObservableCollection<T> instead, but that only kicks off PropertyChanged if the collection has items added or removed and doesn't notify if an item itself changes. I'm used to Angular/Vue which have reactivity baked into their core, but it just feels like I'm having to fight my tools to get basic functionality. I know that I can wire up INotifyPropertyChanged to every class and manually hook up all the property change detection, but that seems like a ton of work considering that two apps I support both have reactivity that totally broken already. Fody/Fody.PropertyChanged added all the boiler plate hook-ups (when I decompiled my dll) but due to the collections not being reactive, the changes never made it up to my parent model. The app is Blazor Server pointed to .Net 8 As a side note, I've been looking at BindingList<T> which has notification events for items changing, but it sounds like that was just added to be used with Win Forms.
4 replies