public TCCDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <TCCDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder()); TCCDbContextConfigurer.Configure(builder, configuration.GetConnectionString(TCCConsts.ConnectionStringName)); return(new TCCDbContext(builder.Options)); }
public override void PreInitialize() { if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <TCCDbContext>(options => { if (options.ExistingConnection != null) { TCCDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { TCCDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); } }