コード例 #1
0
        public InterceptorsDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <InterceptorsDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            InterceptorsDbContextConfigurer.Configure(builder, configuration.GetConnectionString(InterceptorsConsts.ConnectionStringName));

            return(new InterceptorsDbContext(builder.Options));
        }
コード例 #2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <InterceptorsDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 InterceptorsDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 InterceptorsDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }