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