Пример #1
0
        public PsyDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <PsyDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            PsyDbContextConfigurer.Configure(builder, configuration.GetConnectionString(PsyConsts.ConnectionStringName));

            return(new PsyDbContext(builder.Options));
        }
Пример #2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <PsyDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 PsyDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 PsyDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }