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