public CharonXDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <CharonXDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder()); CharonXDbContextConfigurer.Configure(builder, configuration.GetConnectionString(CharonXConsts.ConnectionStringName)); return(new CharonXDbContext(builder.Options)); }
public override void PreInitialize() { // For TiDB Configuration.UnitOfWork.IsolationLevel = IsolationLevel.ReadCommitted; if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <CharonXDbContext>(options => { if (options.ExistingConnection != null) { CharonXDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { CharonXDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); } }