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