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

            CogentDbContextConfigurer.Configure(builder, configuration.GetConnectionString(CogentConsts.ConnectionStringName));

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