public SimpleCMSDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <SimpleCMSDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            SimpleCMSDbContextConfigurer.Configure(builder, configuration.GetConnectionString(SimpleCMSConsts.ConnectionStringName));

            return(new SimpleCMSDbContext(builder.Options));
        }
示例#2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <SimpleCMSDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 SimpleCMSDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 SimpleCMSDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }