public YoyoCmsTemplateDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <YoyoCmsTemplateDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder()); YoyoCmsTemplateDbContextConfigurer.Configure(builder, configuration.GetConnectionString(YoyoCmsTemplateConsts.ConnectionStringName)); return(new YoyoCmsTemplateDbContext(builder.Options)); }
public YoyoCmsTemplateDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <YoyoCmsTemplateDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder()); var connectionString = configuration.ConnectionStringsDefault(); System.Console.WriteLine("迁移使用数据库连接字符串:"); System.Console.WriteLine(connectionString); YoyoCmsTemplateDbContextConfigurer.Configure(configuration, builder, connectionString); return(new YoyoCmsTemplateDbContext(builder.Options)); }
public override void PreInitialize() { if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <YoyoCmsTemplateDbContext>(options => { if (options.ExistingConnection != null) { YoyoCmsTemplateDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { YoyoCmsTemplateDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); } }