// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, LifeDbContext context) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler(); } app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "ApiHelp V1"); }); app.UseStatusCodePages(); app.UseSession(); app.UseMiddleware <JwtTokenAuth>(); app.UseCors("AllRequests"); app.UseMvc(routes => { routes.MapRoute( name: "api", template: "{controller=Login}/{action=Index}/{id?}"); }); //SeedData.Initialize(app.ApplicationServices); context.EnsureSendData(); }
public static void SeedHostDb(LifeDbContext context) { context.SuppressAutoSetTenantId = true; // Host seed new InitialHostDbBuilder(context).Create(); // Default tenant seed (in host database). new DefaultTenantBuilder(context).Create(); new TenantRoleAndUserBuilder(context, 1).Create(); }
private static SqliteConnection CreateDatabaseAndGetConnection() { var connection = new SqliteConnection("Data Source=:memory:"); connection.Open(); var options = new DbContextOptionsBuilder <LifeDbContext>() .UseSqlite(connection) .Options; using (var context = new LifeDbContext(options)) { context.GetService <IRelationalDatabaseCreator>().CreateTables(); } return(connection); }
public DefaultTenantBuilder(LifeDbContext context) { _context = context; }
public DefaultEditionCreator(LifeDbContext context) { _context = context; }
public AccountRepository(LifeDbContext dbContext) : base(dbContext) { }
public DefaultLanguagesCreator(LifeDbContext context) { _context = context; }
public OrderRepository(LifeDbContext dbContext) : base(dbContext) { }
public HostRoleAndUserCreator(LifeDbContext context) { _context = context; }
public TenantRoleAndUserBuilder(LifeDbContext context, int tenantId) { _context = context; _tenantId = tenantId; }
public DefaultSettingsCreator(LifeDbContext context) { _context = context; }
public InitialHostDbBuilder(LifeDbContext context) { _context = context; }