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

            MyFisrtProjectASPNETZERODbContextConfigurer.Configure(builder, configuration.GetConnectionString(MyFisrtProjectASPNETZEROConsts.ConnectionStringName));

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