Exemplo n.º 1
0
        public CmsDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <CmsDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            CmsDbContextConfigurer.Configure(builder, configuration.GetConnectionString(CmsConsts.ConnectionStringName));

            return(new CmsDbContext(builder.Options));
        }
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <CmsDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 CmsDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 CmsDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }