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

            MyProjDbContextConfigurer.Configure(builder, configuration.GetConnectionString(MyProjConsts.ConnectionStringName));

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