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

            SbsAbpDbContextConfigurer.Configure(builder, configuration.GetConnectionString(SbsAbpConsts.ConnectionStringName));

            var dbContext = new SbsAbpDbContext(builder.Options);

            //dbContext.SuppressAutoSetTenantId = true;
            return(dbContext);
        }
예제 #2
0
 public override void PreInitialize()
 {
     Configuration.Modules.AbpEfCore().AddDbContext <SbsAbpDbContext>(options =>
     {
         if (options.ExistingConnection != null)
         {
             SbsAbpDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
         }
         else
         {
             SbsAbpDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
         }
     });
 }