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