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

            AngularBlogDbContextConfigurer.Configure(builder, configuration.GetConnectionString(AngularBlogConsts.ConnectionStringName));

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