コード例 #1
0
ファイル: HRDbContextFactory.cs プロジェクト: sahinme/hr-app
        public HRDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <HRDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            HRDbContextConfigurer.Configure(builder, configuration.GetConnectionString(HRConsts.ConnectionStringName));

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