text: .
  Data validation using Fluent Validation in Windows Phone
  This article explains how to validate data in Windows Phone 8 using the Fluent Validation library.
  Windows Phone 8
  Introduction
  Data validation is required almost everywhere an app takes data input. There are many approaches for Sliverlight/WPF and most of them will also work in Windows Phone.
  This code example explains how to use the Fluent Validation library (available on Nuget), which describes itself as "a small validation library for .NET that uses a fluent interface and lambda expressions for building validation rules for your business objects". The library is simple to use and makes it very easy to define complex but readable validation rules.
  The demo app is a simple user registration form into which a user can enter their name, birth date and country. The example integrates with the MVVM Light Toolkit and its SimpleIoc. The Fluent Validation codeplex page has additional examples.
  Adding the package
  We start of with an empty solution, add the MVVM Light libraries, bind the datacontext of MainPage to MainViewModel in the normal way. Once the MVVM setup is complete it’s time to add the Fluent Validation package to the project.
  Install-Package FluentValidation
  Fluent Validation is an open source project available on Codeplex
  The settings of the portable class library are shown below. Note, the implementation below will work just as well on Windows Store apps!
  The full set of libraries supported by Fluent Validation is: .NET 4.0, MVC 3, MVC 4, MVC 5, Portable
  Creating the model
  There is only one model class in this app, called Member. This defines the user's name, birth date, and country.
  public class Member
  {
  public string Name { get; set; }
  public DateTime BirthDate { get; set; }
  public string Country { get; set; }
  }
  Setting up the validation
  There is some work involved in getting everything setup. Don’t worry, it's not rocket science.
  First create a ValidatorFactory. This is needed because we use SimpleIoc to inject the validators into the ViewModels.
  A ValidatorFactory class inherits from the ValidatorFactoryBase class included in the library.;
  }
  }
  The constructor of the ValidatorFactory is where all validators are being registering. You could do this in the ViewModelLocator as well, like any other class / repository / viewmodel, but this keeps the ViewModelLocator cleaner and keeps the validation logic a bit closer together.
  The CreateInstance function needs to be overridden and returns the instance of the requested validator.
  Building a validator:
  SimpleIoc.Default.Register<ValidatorFactory>(true);
  We pass in true as parameter to make sure the object is instantiated at the moment of registration, that way all validators are registered in the IOC as well (as seen in the ValidatorFactory's constructor).
  As a reference, these are all the built in validators
  - NotNull
  - NotEmpty
  - NotEqual
  - Equal
  - Length
  - LessThan
  - LessThanOrEqual
  - GreaterThan
  - GreaterThanOrEqual
  - Predicate
  - RegEx
  Quite an impressive list, and probably most of what developers will need. Just in case that the one that you need isn't included, you can build your own, we'll discuss that in a bit. Let’s get these rules to work first.
  Validating data
  At this point there is a a factory and validator, and they are all are getting registered in our IOC. Now we hook up the ViewModels and start validating.
  In the MainViewModel add a property of type Member to);
  }
  To validate an instance we call the Validate() function on a validator for that type, in this case "Member". date I get this.
  Our validation is working! But those messages could be a bit better. Fluent Validator provides us with options to adjust the property name or the entire message. Change the constructor of the MemberValidator to this.)
  Summary.
  Note: This article was originally posted in Nico's Blog)