public TemplateRepository(IScopeAccessor scopeAccessor, CacheHelper cache, ILogger logger, ITemplatesSection templateConfig, IFileSystems fileSystems)
     : base(scopeAccessor, cache, logger)
 {
     _masterpagesFileSystem = fileSystems.MasterPagesFileSystem;
     _viewsFileSystem       = fileSystems.MvcViewsFileSystem;
     _templateConfig        = templateConfig;
     _viewHelper            = new ViewHelper(_viewsFileSystem);
     _masterPageHelper      = new MasterPageHelper(_masterpagesFileSystem);
 }
 internal TemplateRepository(IScopeUnitOfWork work, CacheHelper cache, ILogger logger, ISqlSyntaxProvider sqlSyntax, IFileSystem masterpageFileSystem, IFileSystem viewFileSystem, ITemplatesSection templateConfig)
     : base(work, cache, logger, sqlSyntax)
 {
     _masterpagesFileSystem = masterpageFileSystem;
     _viewsFileSystem       = viewFileSystem;
     _templateConfig        = templateConfig;
     _viewHelper            = new ViewHelper(_viewsFileSystem);
     _masterPageHelper      = new MasterPageHelper(_masterpagesFileSystem);
 }
Exemple #3
0
        internal TemplateRepository(IDatabaseUnitOfWork work, CacheHelper cache, ILogger logger, ISqlSyntaxProvider sqlSyntax, IFileSystem masterpageFileSystem, IFileSystem viewFileSystem, ITemplatesSection templateConfig)
            : base(work, cache, logger, sqlSyntax)
        {
            _masterpagesFileSystem = masterpageFileSystem;
            _viewsFileSystem       = viewFileSystem;
            _templateConfig        = templateConfig;
            _viewHelper            = new ViewHelper(_viewsFileSystem);
            _masterPageHelper      = new MasterPageHelper(_masterpagesFileSystem);

            _cacheOptions = new RepositoryCacheOptions
            {
                //Allow a zero count cache entry because GetAll() gets used quite a lot and we want to ensure
                // if there are no templates, that it doesn't keep going to the db.
                GetAllCacheAllowZeroCount = true,
                //GetAll gets called a lot, we want to ensure that all templates are in the cache, default is 100 which
                // would normally be fine but we'll increase it in case people have a ton of templates.
                GetAllCacheThresholdLimit = 500
            };
        }
 private ITemplateRepository CreateRepository(IScopeUnitOfWork unitOfWork, ITemplatesSection templatesSection = null)
 {
     return(new TemplateRepository(unitOfWork, CacheHelper.CreateDisabledCacheHelper(), Mock.Of <ILogger>(), SqlSyntax, _masterPageFileSystem, _viewsFileSystem,
                                   templatesSection ?? Mock.Of <ITemplatesSection>(t => t.DefaultRenderingEngine == RenderingEngine.Mvc)));
 }
 private ITemplateRepository CreateRepository(IScopeProvider provider, ITemplatesSection templatesSection = null)
 {
     return(new TemplateRepository((IScopeAccessor)provider, CacheHelper.Disabled, Logger,
                                   templatesSection ?? Mock.Of <ITemplatesSection>(t => t.DefaultRenderingEngine == RenderingEngine.Mvc),
                                   _fileSystems));
 }