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