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