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

            SolutionsDbContextConfigurer.Configure(builder, configuration.GetConnectionString(SolutionsConsts.ConnectionStringName));

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