Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fluent validation extension for ninject.web.mvc
Batchfile C#

Merge pull request #8 from rexcfnghk/refactor

Refactor NinjectValidatorFactory
latest commit e911d3d0d1
@scott-xu scott-xu authored

README.markdown

FluentValidation Ninject integration

To use follow these steps:

  1. Wire up Asp.net MVC to use the NinjectValidatorFactory:
NinjectValidatorFactory ninjectValidatorFactory = new NinjectValidatorFactory(ninjectKernel);
ModelValidatorProviders.Providers.Add(new FluentValidationModelValidatorProvider(ninjectValidatorFactory));
DataAnnotationsModelValidatorProvider.AddImplicitRequiredAttributeForValueTypes = false;
  1. Add a module to your project that will bind all of your validators:
public class FluentValidatorModule : NinjectModule
{
    public override void Load()
    {
        AssemblyScanner.FindValidatorsInAssemblyContaining<UserValidator>()
            .ForEach(match => Bind(match.InterfaceType).To(match.ValidatorType));
    }
}
Something went wrong with that request. Please try again.