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

            RecyclopsDbContextConfigurer.Configure(builder, configuration.GetConnectionString(RecyclopsConsts.ConnectionStringName));

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