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