예제 #1
0
        public void Configure(
            IApplicationBuilder app,
            IHostingEnvironment env,
            ILoggerFactory loggerFactory,
            WpDbContext dbContext)
        {
            app.UseRequestContextMiddleware();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseAuthentication();

            app.UseStaticFiles("");

            app.UseStatusCodePagesWithRedirects("/");

            app.UseMvc(
                routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=BaseView}/{action=Index}/{id?}");
                routes.MapSpaFallbackRoute(
                    name: "spa-fallback",
                    defaults: new
                {
                    controller = "BaseView",
                    action     = "Index"
                });
            }
                );
#if DEBUG
            var orderOfDroppage = new List <string>
            {
                "Invitee",
                "MealChoice",
                "Relationship",
                "Invitation",
                "Address",
                "AppUserClaim",
                "AppUserLogin",
                "AppUserToken",
                "AspNetUserRoles",
                "AspNetRoleClaims",
                "AspNetRoles",
                "AppUser"
            };

            dbContext.DropTablesAndEnsureCreated(true, orderOfDroppage);
#endif
        }
 public ApiAccountController(
     ITokenFactory jwtTokenFactory,
     Settings settings,
     SignInManager <AppUser> signInManager,
     UserManager <AppUser> userManager,
     WpDbContext context)
 {
     _jwtTokenFactory = jwtTokenFactory;
     _settings        = settings;
     _signInManager   = signInManager;
     _userManager     = userManager;
     _context         = context;
 }
        public static void Migrate(IApplicationBuilder app)
        {
            using (var serviceScope = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>().CreateScope())
            {
                using (TenantDbContext tContext = serviceScope.ServiceProvider.GetService <TenantDbContext>())
                {
                    tContext.Database.Migrate();
                    var tenantService = serviceScope.ServiceProvider.GetService <ITenantService>();
                    using (WpDbContext context = serviceScope.ServiceProvider.GetService <WpDbContext>())
                    {
                        context.Database.Migrate();

                        tenantService.InstallTenants();
                        var tenants = tenantService.GetAll();
                        foreach (var t in tenants)
                        {
                            WpDbContext wpContext = new WpDbContext(new DbContextOptions <WpDbContext>(), t.ConnectionString);
                            wpContext.Database.Migrate();
                        }
                    }
                }
            }
        }
예제 #4
0
 public BaseRepository(WpDbContext context)
 {
     Context = context;
 }
예제 #5
0
 public ExpenseRepository(WpDbContext context) : base(context)
 {
 }