public FamilyGuyDbContext CreateDbContext(string[] args) { DbContextOptionsBuilder <FamilyGuyDbContext> optionsBuilder = new DbContextOptionsBuilder <FamilyGuyDbContext>(); SqlSettings sqlSettings = new SqlSettings(); new ConfigurationBuilder() .SetBasePath(AppContext.BaseDirectory) .AddJsonFile(GetAppSettingsFileName()) .AddEnvironmentVariables() .Build() .GetSection("Sql") .Bind(sqlSettings); optionsBuilder.UseSqlServer(sqlSettings.ConnectionString); return(new FamilyGuyDbContext(optionsBuilder.Options, sqlSettings)); }
public FamilyGuyDbContext(DbContextOptions <FamilyGuyDbContext> options, SqlSettings settings) : base(options) { _settings = settings; }