In some cases it would be desired to enter a context when writing validation rules, so that we do not repeat our self. e.g.
When(Any).Then(
Field("person.name", !Must.Be.NullOrEmpty()) &
Field("person.familyName", !Must.Be.NullOrEmpty()) &
Field("person.age", !Must.Be.NullOrEmpty()) &
Field("person.gender", !Must.Be.NullOrEmpty())
);
Would be replacable by something like: (Syntax not decided)
using(With("person")) {
When(Any).Then(
Field("name", !Must.Be.NullOrEmpty()) &
Field("familyName", !Must.Be.NullOrEmpty()) &
Field("age", !Must.Be.NullOrEmpty()) &
Field("gender", !Must.Be.NullOrEmpty())
);
}
To say that each of the following rules are children of the parent "person".
In some cases it would be desired to enter a context when writing validation rules, so that we do not repeat our self. e.g.
Would be replacable by something like: (Syntax not decided)
To say that each of the following rules are children of the parent "person".