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