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

            InterviewDbContextConfigurer.Configure(builder, configuration.GetConnectionString(InterviewConsts.ConnectionStringName));

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