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

            CMADbContextConfigurer.Configure(builder, configuration.GetConnectionString(CMAConsts.ConnectionStringName));

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