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

            TGDbContextConfigurer.Configure(builder, configuration.GetConnectionString(TGConsts.ConnectionStringName));

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