Apply currently does three tasks:
- It converts
input into the correct data type needed for Evaluate()
- It applies all the rules (often by running
Evaluate()
- It either returns an
ValidationErrorCollection or converts the results to the correct output type.
This issue has the goal of making it possible to do steps 1 and 2 independently by adding a new method called Transform that converts the input type into the type expected by Evaluate().
This has a number of benefits:
- Apply cannot be run concurrently because the output value can be changed, making it not thread safe, but
Evaluate() can be run concurrently. So by allowing the unsafe portion of Apply() to be run independently we gain the ability to evaluate concurrently.
- Calling functions have more control over execution.
- Formalizes the expected behavior of
Apply().
- Allow for more code reuse.
Applycurrently does three tasks:inputinto the correct data type needed forEvaluate()Evaluate()ValidationErrorCollectionor converts the results to the correctoutputtype.This issue has the goal of making it possible to do steps 1 and 2 independently by adding a new method called
Transformthat converts the input type into the type expected byEvaluate().This has a number of benefits:
Evaluate()can be run concurrently. So by allowing the unsafe portion ofApply()to be run independently we gain the ability to evaluate concurrently.Apply().