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