示例#1
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IWorldServer worldServer, ILogsDatabase logsDb, IDatabase mainDb)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseRouting();

            mainDb.Migrate();
            logsDb.Migrate();
            worldServer.Start();
        }
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IWorldServer worldServer, ILogsDatabase logsDb, IDatabase mainDb, IGameDefinitionsPreloder definitionsPreloder, RoleManager <DbRole> roleManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapBlazorHub();
                endpoints.MapFallbackToPage("/_Host");
            });


            roleManager.CreateAsync(new DbRole()
            {
                Name = DbRole.SUPER_ADMIN
            }).Wait();
            roleManager.CreateAsync(new DbRole()
            {
                Name = DbRole.ADMIN
            }).Wait();
            roleManager.CreateAsync(new DbRole()
            {
                Name = DbRole.USER
            }).Wait();

            mainDb.Migrate();
            logsDb.Migrate();
            definitionsPreloder.Preload();
            worldServer.Start();
        }