// This method gets called by the runtime. Use this method to add services to the container. public IServiceProvider ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); //注册实体映射 ColumnMapper.SetMapper(); return(AutofacRegister.RegisterAutofac(services)); }
protected void Application_Start() { _logHelper = LogHelperFactory.GetLogHelper <MvcApplication>(); if (AppContext.EFProfilerEnable) { //MiniProfilerEF6初始化,必须放在第一行 //因为要监控ef,所以要在ef初始化之前 MiniProfilerEF6.Initialize(); } //ASP.NET 路由操作处理所有请求(甚至包括与现有文件匹配的请求) RouteTable.Routes.RouteExistingFiles = true; //注册视图引擎 ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(new RazorViewEngine()); ViewEngines.Engines.Add(new WebFormViewEngine()); //注册所有区域 AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); //ioc配置 AutofacRegister.RegisterAutofac(); EFWormUp(); }