Exemple #1
0
        public PhoneDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <PhoneDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            PhoneDbContextConfigurer.Configure(builder, configuration.GetConnectionString(PhoneConsts.ConnectionStringName));

            return(new PhoneDbContext(builder.Options));
        }
Exemple #2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <PhoneDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 PhoneDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 PhoneDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }