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

            SdtDbContextConfigurer.Configure(builder, configuration.GetConnectionString(SdtConsts.ConnectionStringName));

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