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