Пример #1
0
        public MonivaultDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <MonivaultDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            MonivaultDbContextConfigurer.Configure(builder, configuration.GetConnectionString(MonivaultConsts.ConnectionStringName));

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