Fluent validation extension for ninject.web.mvc
Batchfile C#
Latest commit e911d3d Jul 25, 2015 @scott-xu scott-xu Merge pull request #8 from rexcfnghk/refactor
Refactor NinjectValidatorFactory
Failed to load latest commit information.
lib/Ninject
nuget Updated to FluentValidation 3.4.6 Mar 27, 2013
packages Updated to FluentValidation 3.4.6 Mar 27, 2013
src
tools
.gitignore
HowToBuild.txt Updated How to Build - Reference teamcity.bbv.ch instead of codebetter Jan 10, 2014
Ninject.Web.Mvc.FluentValidation.build
Ninject.Web.Mvc.FluentValidation.sln
Ninject.build
Ninject.include Adapted scripts to mono 3.4 Sep 3, 2014
README.markdown Update README.markdown Aug 4, 2012
ReleaseNotes.txt
UnzipDependencies.cmd
build-alpha.cmd
build-beta.cmd
build-rc1.cmd Updated to Nuget 1.6 and added support for prerelease packages Dec 23, 2011
build-release.cmd
build.cmd Added build scripts Oct 21, 2010

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