コード例 #1
0
 public ApplicationDataLoader(
     IFacilityService facilityService,
     IWorldService worldService,
     IZoneService zoneService,
     IDbSeeder dbSeeder,
     ILogger <ApplicationDataLoader> logger)
 {
     _facilityService = facilityService;
     _worldService    = worldService;
     _zoneService     = zoneService;
     _dbSeeder        = dbSeeder;
     _logger          = logger;
 }
コード例 #2
0
ファイル: Startup.cs プロジェクト: GregsonJamesMedel/50Pixels
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IDbSeeder seeder)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();

            app.UseStaticFiles();
            app.UseAuthentication();
            app.UseMvcWithDefaultRoute();

            seeder.Seed();
        }
コード例 #3
0
 public ApplicationDataLoader(
     IItemCategoryService itemCategoryService,
     IScrimRulesetManager rulesetManager,
     IScrimMatchScorer matchScorer,
     IFacilityService facilityService,
     IWorldService worldService,
     IZoneService zoneService,
     IDbSeeder dbSeeder,
     ILogger <ApplicationDataLoader> logger)
 {
     _itemCategoryService = itemCategoryService;
     _rulesetManager      = rulesetManager;
     _matchScorer         = matchScorer;
     _facilityService     = facilityService;
     _worldService        = worldService;
     _zoneService         = zoneService;
     _dbSeeder            = dbSeeder;
     _logger = logger;
 }
コード例 #4
0
ファイル: Startup.cs プロジェクト: thor1824/PetShop.CS
        // 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())
            {
                using (var scope = app.ApplicationServices.CreateScope())
                {
                    // Initialize the database
                    var services             = scope.ServiceProvider;
                    PetShopAppContext ctx    = services.GetService <PetShopAppContext>();
                    IDbSeeder         seeder = services.GetService <IDbSeeder>();
                    seeder.Seed(ctx);
                    app.UseDeveloperExceptionPage();
                }
            }
            else
            {
                using (var scope = app.ApplicationServices.CreateScope())
                {
                    // Initialize the database
                    var services             = scope.ServiceProvider;
                    PetShopAppContext ctx    = services.GetService <PetShopAppContext>();
                    IDbSeeder         seeder = services.GetService <IDbSeeder>();
                    seeder.Seed(ctx);
                    seeder.Seed(ctx);
                    app.UseHsts();
                }
            }

            //app.UseHttpsRedirection();

            // Enable CORS (must precede app.UseMvc()):
            app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());

            // Use authentication
            app.UseAuthentication();

            app.UseMvc();
        }
コード例 #5
0
ファイル: Startup.cs プロジェクト: vroyibg/wealth-manager
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IDbSeeder dbSeeder)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                dbSeeder.Seed();
            }

            if (env.IsProduction())
            {
                app.UseHttpsRedirection();
            }

            // global cors policy
            app.UseCors(
                x => x.AllowAnyOrigin()
                .AllowAnyMethod()
                .AllowAnyHeader());

            app.UseResponseCompression();
            app.UseRouting();
            // Enable middleware to serve generated Swagger as a JSON endpoint.
            app.UseSwagger();

            // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
            // specifying the Swagger JSON endpoint.
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Wealth Manager API V1");
            });

            app.UseAuthentication();
            app.UseAuthorization();
            app.UseMiddleware <ExceptionHandleMiddleware>();

            app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
        }
コード例 #6
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IDbSeeder seeder, IServiceProvider serviceProvider)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MzE5MzQ4QDMxMzgyZTMyMmUzMEI2L0VJSnNCS1ZaaUh1WjUyditEWUsvMzZHaDJmc1IzQTBKZkxaTGM2Vzg9");

            seeder.Seed(env.IsDevelopment());

            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

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

            GlobalConfiguration.Configuration.UseActivator(new CustomJobActivator(serviceProvider));
            app.UseHangfireDashboard("/jobs");
            app.UseHangfireServer();

            RecurringJob.AddOrUpdate <IEmailAvailableShiftService>(x => x.SendNotifications(), Cron.Weekly(DayOfWeek.Saturday));
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapRazorPages();
                endpoints.MapControllers();
            });
        }
コード例 #7
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory,
                              IServiceStarter starter, IDbSeeder seeder)
        {
            loggerFactory.AddDebug();
            loggerFactory.AddSerilog();

            app.UseExceptionHandler(options =>
            {
                options.Run(
                    async context =>
                {
                    context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                    var ex = context.Features.Get <IExceptionHandlerFeature>();
                    if (ex != null)
                    {
                        var err = $"Error: {ex.Error.Message}{ex.Error.StackTrace}";
                        Log.Error(ex.Error, "Server Error", ex);
                        await context.Response.WriteAsync(err).ConfigureAwait(false);
                    }
                });
            });

            app.UseCors("CorsPolicy");

            seeder.Seed(Configuration.GetSection("AppSettings:ConnectionString").Value);
            starter.Start();

            app.UseSwagger();
            app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); });

            app.UseAuthentication();
            app.UseStatusCodePages();
            app.UseStaticFiles();
            app.UseDefaultFiles();
            app.UseMvc();
        }
コード例 #8
0
 public AccountController(UserManager <UserEntity> userManager, IDbSeeder seeder)
 {
     _userManager = userManager;
     _seeder      = seeder;
 }
コード例 #9
0
 public PositionsController(IPositionService positionService, IDbSeeder seeder)
 {
     _positionService = positionService;
     _seeder          = seeder;
 }
コード例 #10
0
 public UsersController(IUserService userService, IWebHostEnvironment env, IDbSeeder seeder)
 {
     _userService   = userService;
     _env           = env;
     _seederService = seeder;
 }
コード例 #11
0
 public DataGeneratorController(IDbSeeder DbSeeder)
 {
     _DbSeeder = DbSeeder;
 }
コード例 #12
0
 public BooksController(ApplicationDbContext context, IDbSeeder <ApplicationDbContext> seeder)
 {
     _context = context;
     _seeder  = seeder;
 }
コード例 #13
0
 public TimesheetController(ITimesheetService tsService, IDbSeeder dbSeeder)
 {
     _tsService = tsService;
     _dbSeeder  = dbSeeder;
 }
コード例 #14
0
 public TeamsController(ITeamService memberService, IWebHostEnvironment env, IDbSeeder seeder)
 {
     _teamService   = memberService;
     _env           = env;
     _seederService = seeder;
 }
コード例 #15
0
 public DbSeederHostedService(IDbSeeder service)
 {
     _service = service;
 }