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