Open rockfordlhotka opened 4 years ago
@rockfordlhotka , this would work for 'tightly coupled' business rules (am I a right?), for non-coupled business rules we don't have to use this.
Right - I haven't figured out a loosely coupled scheme for data binding. Though maybe something when adding the rule?
BusinessRules.AddRule<MyRule>(OrderItem.NameProperty, Order.TaxCodeProperty);
I don't actually know how that would be implemented 😄 I'm just playing with ideas here.
I like this approach, it would open all kinds of doors to implement business rules that could access any property in the object graph, exciting times to be a software develoepr :)
I had an idea. Might be good, might be bad, I thought I'd float it out here and see what people think.
The idea is that writing a rule today usually means creating a constructor and adding items to the input properties collection. Which is ok, but not declarative. Also, there's not a good way to reference values from other parts of the object graph - ancestors, siblings, or children of the target object.
I don't have this clearly in my head - but it occurred to me that XAML data binding has mechanisms for binding to ancestors at least. Maybe there's some way to make life better?
This is pretty vague - what do you think though?