Fluent validation extension for ninject.web.mvc
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/Ninject
nuget
packages
src
tools
.gitignore
HowToBuild.txt
Ninject.Web.Mvc.FluentValidation.build
Ninject.Web.Mvc.FluentValidation.sln
Ninject.build
Ninject.include
README.markdown
ReleaseNotes.txt
UnzipDependencies.cmd
build-alpha.cmd
build-beta.cmd
build-rc1.cmd
build-release.cmd
build.cmd

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));
    }
}