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