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