title: FluentValidation and Entity Framework Lookups
body: <p>I have an ASP.NET MVC application with Entity Framework.  This application scopes the DbContext to the current HTTP request, but also accounts for out of band requests, returning a new DbContext for every request.  I have the default Fluent validation provider registered like:</p>
  
  <pre><code>FluentValidationModelValidatorProvider.Configure();
  </code></pre>
  
  <p>In the constructor I have some dependencies on Entity Framework:</p>
  
  <pre><code>public class SomeValidator : AbstractValidator&lt;Customer&gt;
  {
     public SomeValidator()
     {
       private _refService = //Get IReferenceDataService through DI container
       Dim refID = _refService.GetID(details of value to find ID for);
  
         RuleFor((m) =&gt; m.Field).Must((o, v) =&gt;
              {
                  if (v == reID)
                    return false;
                  else
                      ...
              }).WithMessage("..");
     }
  }
  </code></pre>
  
  <p>The call to return a value to refID hits the database using Entity Framework.  Does the constructor run during the HTTP request, thus using my cached EF container for the current request, or will this happen in an out-of-bound fashion?  I'm not sure when the validator gets initialized...</p>