protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); //Configure structuremap ObjectFactory.Configure(cfg => cfg.AddRegistry(new MyRegistry())); ControllerBuilder.Current.SetControllerFactory(new StructureMapControllerFactory()); //Configure FV to use StructureMap var factory = new StructureMapValidatorFactory(); //Tell MVC to use FV for validation ModelValidatorProviders.Providers.Add(new FluentValidationModelValidatorProvider(factory)); DataAnnotationsModelValidatorProvider.AddImplicitRequiredAttributeForValueTypes = false; }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); //Configure structuremap ObjectFactory.Configure(cfg => cfg.AddRegistry(new MyRegistry())); ControllerBuilder.Current.SetControllerFactory(new StructureMapControllerFactory()); //Configure FV to use StructureMap var factory = new StructureMapValidatorFactory(); //Tell MVC to use FV for validation ModelValidatorProviders.Providers.Add(new FluentValidationModelValidatorProvider(factory)); DataAnnotationsModelValidatorProvider.AddImplicitRequiredAttributeForValueTypes = false; }