using DatabaseCore.Models.Security; using Microsoft.EntityFrameworkCore; namespace DatabaseCore { public class DatabaseContext : DbContext { public DatabaseContext() : base() { } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (optionsBuilder.IsConfigured == false) { #if RELEASE var connectionString = ModelTools.ServiceProvider.ServiceProviderLoader.GetConfigData("connectionString"); optionsBuilder.UseSqlServer(connectionString); #endif #if DEBUG optionsBuilder.UseSqlServer(@"Data Source=CHESHIR\SQLEXPRESS;Initial Catalog=DepartmentDatabasePortal;persist security info=True;user id=admin;password=cheshirSA123;MultipleActiveResultSets=True;"); #endif } base.OnConfiguring(optionsBuilder); } public virtual DbSet Accesses { set; get; } public virtual DbSet EnviromentSettings { set; get; } public virtual DbSet Roles { set; get; } public virtual DbSet Users { set; get; } public virtual DbSet UserRoles { set; get; } } }