示例#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, MasterShopDbContext db)
        {
            var rolesConfig = new RolesExtensionsConfiguration(app, db);

            rolesConfig.CreateRoles().Wait();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler(GlobalConstants.ExeptionHandlerErr);
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();
            app.UseRouting();
            app.UseSession();
            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: GlobalConstants.Name,
                    pattern: GlobalConstants.Pattern);
                endpoints.MapRazorPages();
            });
        }
示例#2
0
 public ProductsService(MasterShopDbContext db)
 {
     this.db = db;
 }
示例#3
0
 public RolesExtensionsConfiguration(IApplicationBuilder app, MasterShopDbContext db)
 {
     this.app = app;
     this.db  = db;
 }
示例#4
0
 public OrdersService(MasterShopDbContext db)
 {
     this.db = db;
 }
示例#5
0
 public CategoriesService(MasterShopDbContext db)
 {
     this.db = db;
 }
示例#6
0
 public UsersService(MasterShopDbContext db, IMapper mapper)
 {
     this.db     = db;
     this.mapper = mapper;
 }