Implement a validator for Silverlight 4 and WPF4 using fluent interface

Implementing a validator for domain object leverage on the straightforward and powerfull fluent interfaces.
By now, validate your objectis is as easy as inherit from ValidationMapping and override the Map Method.
In this way, you can add all the required business logic in just few lines of code.

public class CustomerViewModelValidationMapping : ValidationMapping<ValidableCustomerViewModel>
{
    protected override void Map()
    {
      Map(x => x.FirstName)
        .Required()
        .Length(2);
  
      Map(x => x.LastName)
        .Required()
        .Length(2);
     }
}

Last edited Sep 1, 2010 at 2:57 PM by teoarch, version 3

Comments

No comments yet.