Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To register an IValidator instance on a ModelBase, use the following code:

Code Block
myObjectvar modelValidation = myModel as IModelValidation;
if (modelValidation != null)
{
    modelValidation .Validator = new MyValidator();
}

If an IValidatorProvider instance is available, the following code can be used to allow a more generic approach. This code assumes that the IValidatorProvider is registered in the ServiceLocator.

...