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