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

            VOUDbContextConfigurer.Configure(builder, configuration.GetConnectionString(VOUConsts.ConnectionStringName));

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