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