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