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

            BloggsDbContextConfigurer.Configure(builder, configuration.GetConnectionString(BloggsConsts.ConnectionStringName));

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