protected void Application_Start() { CustomToolchain.Register(); // if you need additional utility-like functions, register them here (insted of at models level) // !attributes registration done here: ------------------------------------------------------------------- // required for client-side validation to be working, but redundant if built-in ea model validation provider is used (see statement below) // RegisterExpressiveAttributes(); // ea model validation provider added here, it automatically registers adapters for expressive validation attributes and respects their processing priorities when validation is performed // RegisterExpressiveModelValidatorProvider(); // just for demo, if you redefine attributes and validators, because you need to e.g. override global error messages, register them here as well // RegisterAdditionalExpressiveAttributes(); // best way - write custom provider by inheriting from ExpressiveAnnotationsModelValidatorProvider, and do it all there (keeps priorities working everywhere) RegisterCustomExpressiveModelValidatorProvider(); // !------------------------------------------------------------------------------------------------------ AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseSession(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); CustomToolchain.Register(); }