Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory logging)
        {
            #region AntORM
            //文档:https://github.com/yuzd/AntData.ORM
            app.UseAntData();
            #endregion

            #region AutoMapperConfig
            var autoMapperConfig = new Mapping.AutoMapper();
            autoMapperConfig.ExecuteByAssemblyName("DbModel", "ServicesModel");
            #endregion

            app.UseStaticFiles();

            app.UseStatusCodePagesWithReExecute("/admin/error/{0}");

            app.UseRouting();

            app.UseCors();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapRazorPages();
                endpoints.MapAreaControllerRoute(
                    name: "Admin", "Admin",
                    pattern: "Admin/{controller=Home}/{action=Index}/{id?}");
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });

            Infrastructure.Web.HttpContext.ServiceProvider = this.AutofacContainer = app.ApplicationServices.GetAutofacRoot();
        }
Exemplo n.º 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory logging)
        {
            #region AntORM
            //文档:https://github.com/yuzd/AntData.ORM
            app.UseAntData();
            #endregion

            #region AutoMapperConfig
            var autoMapperConfig = new Mapping.AutoMapper();
            autoMapperConfig.ExecuteByAssemblyName("DbModel", "ServicesModel");
            #endregion

            app.UseStaticFiles();

            app.UseStatusCodePagesWithReExecute("/admin/error/{0}");

            app.UseMvc(routes =>
            {
                // areas
                routes.MapRoute(
                    name: "Admin",
                    template: "{area:exists}/{controller=Home}/{action=Index}/{id?}");

                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
Exemplo n.º 3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory logging)
        {
            #region AntORM
            //文档:https://github.com/yuzd/AntData.ORM
            AntData.ORM.Common.Configuration.UseDBConfig(Configuration);
            AntData.ORM.Common.Configuration.Linq.AllowMultipleQuery = true;
            #endregion

            #region NLOG
            NLog.LogManager.LoadConfiguration("nlog.config");
            logging.AddNLog();
            #endregion

            #region AutoMapperConfig
            var autoMapperConfig = new Mapping.AutoMapper();
            autoMapperConfig.ExecuteByAssemblyName("DbModel", "ServicesModel");
            #endregion

            app.UseStaticFiles();

            app.UseStatusCodePagesWithReExecute("/error/{0}");

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }