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