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

            TBKDbContextConfigurer.Configure(builder, configuration.GetConnectionString(TBKConsts.ConnectionStringName));

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