This repository was archived by the owner on Jun 5, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 6
"Data binding" for rules #945
Copy link
Copy link
Open
Labels
Description
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?
public class MyRule : BusinessRule
{
[BindTarget(OrderItem.NameProperty)]
public string Name { get; set; }
[BindAncestor(Order.TaxCodeProperty)]
public string TaxCode { get; set; }
}This is pretty vague - what do you think though?