public LocalCoreDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <LocalCoreDbContext>(); //var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder()); MyDocumentManageDbContextConfigurer.Configure(builder, AppConfigurtaionServices.GetAppSettings()["ConnectionStrings:mydb"]); return(new LocalCoreDbContext()); }
public DbContextOptions <LocalCoreDbContext> GetDbContextOption() { var builder = new DbContextOptionsBuilder <LocalCoreDbContext>(); //var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder()); //MyDocumentManageDbContextConfigurer.Configure(builder, configuration.GetConnectionString("mydb")); MyDocumentManageDbContextConfigurer.Configure(builder, AppConfigurtaionServices.GetAppSettings()["ConnectionStrings:mydb"]); return(builder.Options); }
public override void PreInitialize() { if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <LocalCoreDbContext>(options => { if (options.ExistingConnection != null) { MyDocumentManageDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { MyDocumentManageDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); } }