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