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

            MPACorePhoneBookDbContextConfigurer.Configure(builder, configuration.GetConnectionString(MPACorePhoneBookConsts.ConnectionStringName));

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