title: instantiate ValidatorFactory with unity ioc
body: <p>I am having some trouble trying to integrate FluentValidation with Unity.</p>
  
  <p>I have a factory class</p>
  
  <pre><code>  public class UnityValidatorFactory : FluentValidation.ValidatorFactoryBase
  {
      private readonly IUnityContainer _container;
  
      public UnityValidatorFactory()
      {
          _container = null;
      }
  
      public UnityValidatorFactory(IUnityContainer container)
      {
          _container = container;
      }
  
      public override FluentValidation.IValidator CreateInstance(Type validatorType)
      {
          return _container.Resolve(validatorType) as FluentValidation.IValidator;
      }
  
  }
  </code></pre>
  
  <p>The problem is that it won't instantiate in the data class</p>
  
  <pre><code> public class Payment : IValidatableObject
  {
      private readonly IValidator _validator = new PaymentValidator();
  
      public string paymentType { get; set; }
     //etc
  
      public Payment(IValidatorFactory validatorFactory)
      {
          **//ValidatorFactory is always null!**
          _validator = validatorFactory.GetValidator(typeof(Payment));
      }
  }
  </code></pre>
  
  <p>This is the code I am trying to use to register the factory class with unity</p>
  
  <pre><code>container.RegisterType&lt;IValidatorFactory, UnityValidatorFactory&gt;(new ContainerControlledLifetimeManager());
  </code></pre>
  
  <p>However the factory is always null. Any idea what I am doing wrong?</p>