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

            LeesStoreDbContextConfigurer.Configure(builder, configuration.GetConnectionString(LeesStoreConsts.ConnectionStringName));

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