I am having a little trouble with validation rules not firing on a BusinessBase object, here is my AddBusinessRules method:
protected override void AddBusinessRules()
ValidationRules.AddRule(CustomCommonRules.UniqueCombination<CheckProductPriceVendorAndPriceGroup>, IdProperty, VendorIdProperty, PriceGroupIdProperty);
Now if I change the PriceGroupId property the rules don't fire.
What I did is to override the OnPropertyChanged and fire the rules like ValidationRules.CheckRules, but this gives me a different error.
"Cannot change ObservableCollection during a CollectionChanged or PropertyChanged event."
Any idea on how can I work around this ?
Your code is adding an async rule to the IdProperty. You need to add the rule to PriceGroupId, or make PriceGroupId a dependent property on IdProperty if you want the rule to run when PriceGroupId is changed.
Thank you, this did the trick.
Copyright (c) Marimer LLC