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