Skip to content

ninject/Ninject.Web.Mvc.FluentValidation

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.

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

About

Fluent validation extension for ninject.web.mvc

Resources

Stars

Watchers

Forks

Packages

No packages published