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