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