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

            PartiesDbContextConfigurerPostgres.Configure(builder, configuration.GetConnectionString(PartiesConsts.ConnectionStringName));

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