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