예제 #1
0
        public static void Initialize(SgConContext context)
        {
            context.Database.EnsureCreated();

            AddressTypeDbSeed addressTypeDbSeed = new AddressTypeDbSeed(context);

            AddressDbSeed addressDbSeed = new AddressDbSeed(context);

            CondominiumDbSeed condominiumDbSeed = new CondominiumDbSeed(context);

            TowerDbSeed towerDbSeed = new TowerDbSeed(context);

            ApartmentDbSeed apartmentDbSeed = new ApartmentDbSeed(context);

            RoleDbSeed roleDbSeed = new RoleDbSeed(context);

            ProfileDbSeed profileDbSeed = new ProfileDbSeed(context);

            EmployeeDbSeed employeeDbSeed = new EmployeeDbSeed(context);

            ResidentDbSeed residentDbSeed = new ResidentDbSeed(context);

            CompanyDbSeed companyDbSeed = new CompanyDbSeed(context);

            CommonAreaDbSeed commonAreaDbSeed = new CommonAreaDbSeed(context);
        }
예제 #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, EmployeeDbSeed employeeDbSeed)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseMvc();
            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
            });
            app.UseCloudFoundryActuators();
            app.UseRefreshActuator();
            EmployeeDbInitialize.init(app.ApplicationServices.GetRequiredService <IServiceScopeFactory>().CreateScope().ServiceProvider);
            employeeDbSeed.SeedEmployees().Wait();
        }