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