public static RegisterGlobalFilters ( GlobalFilterCollection filters ) : void | ||
filters | GlobalFilterCollection | |
return | void |
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); DataAnnotationsModelValidatorProvider validatorProvider = ModelValidatorProviders.Providers.OfType <DataAnnotationsModelValidatorProvider>().FirstOrDefault(); if (null != validatorProvider) { ModelValidatorProviders.Providers.Remove(validatorProvider); } ModelValidatorProviders.Providers.Add(new ParameterValidationModelValidatorProvider()); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); //设置MEF依赖注入容器 DirectoryCatalog catalog = new DirectoryCatalog(AppDomain.CurrentDomain.SetupInformation.PrivateBinPath); MefDependencySolver solver = new MefDependencySolver(catalog); //MVC依赖注入 DependencyResolver.SetResolver(solver); }