Exemplo n.º 1
0
        public MyPhoneBookDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <MyPhoneBookDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            MyPhoneBookDbContextConfigurer.Configure(builder, configuration.GetConnectionString(MyPhoneBookConsts.ConnectionStringName));

            return(new MyPhoneBookDbContext(builder.Options));
        }
Exemplo n.º 2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <MyPhoneBookDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 MyPhoneBookDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 MyPhoneBookDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }