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

            MyFirstABPProjectDbContextConfigurer.Configure(builder, configuration.GetConnectionString(MyFirstABPProjectConsts.ConnectionStringName));

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