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

            AbpProjectNameDbContextConfigurer.Configure(builder, configuration.GetConnectionString(AbpProjectNameConsts.ConnectionStringName));

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