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

            MyCmsDbContextConfigurer.Configure(builder, configuration.GetConnectionString(MyCmsConsts.ConnectionStringName));

            return(new MyCmsDbContext(builder.Options));
        }
Ejemplo n.º 2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <MyCmsDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 MyCmsDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 MyCmsDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }