Пример #1
0
        /// <summary>
        /// Creates a new api from the currently registered
        /// repositories.
        /// </summary>
        public Api(
            IContentFactory contentFactory,
            IAliasRepository aliasRepository,
            IArchiveRepository archiveRepository,
            IMediaRepository mediaRepository,
            IPageRepository pageRepository,
            IPageTypeRepository pageTypeRepository,
            IParamRepository paramRepository,
            IPostRepository postRepository,
            IPostTypeRepository postTypeRepository,
            ISiteRepository siteRepository,
            ISiteTypeRepository siteTypeRepository,
            ICache cache              = null,
            IStorage storage          = null,
            IImageProcessor processor = null)
        {
            // Store the cache
            _cache = cache;

            // Create services without dependecies
            PageTypes = new PageTypeService(pageTypeRepository, cache);
            Params    = new ParamService(paramRepository, cache);
            PostTypes = new PostTypeService(postTypeRepository, cache);
            Sites     = new SiteService(siteRepository, contentFactory, cache);
            SiteTypes = new SiteTypeService(siteTypeRepository, cache);

            // Create services with dependencies
            Aliases  = new AliasService(aliasRepository, Sites, cache);
            Media    = new MediaService(mediaRepository, Params, storage, processor, cache);
            Pages    = new PageService(pageRepository, contentFactory, Sites, Params, cache);
            Posts    = new PostService(postRepository, contentFactory, Sites, Pages, cache);
            Archives = new ArchiveService(archiveRepository, Params, Posts);
        }
Пример #2
0
 public GetParamsService(IMemoryCache memoryCache,
                         IParamRepository paramRepository)
 {
     _cache        = memoryCache;
     _cacheOptions = new MemoryCacheEntryOptions()
                     .SetSlidingExpiration(TimeSpan.FromHours(2));
     _paramRepository = paramRepository;
 }
Пример #3
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="repo">The main repository</param>
        /// <param name="cache">The optional model cache</param>
        public ParamService(IParamRepository repo, ICache cache = null)
        {
            _repo = repo;

            if ((int)App.CacheLevel > 0)
            {
                _cache = cache;
            }
        }
Пример #4
0
 public ParamService(IParamRepository repo, ICache cache = null)
 {
     base();
     this._repo = repo;
     if (App.get_CacheLevel() > 0)
     {
         this._cache = cache;
     }
     return;
 }
Пример #5
0
 public ParamController(ILogger <ParamController> logger, IParamRepository paramRepository)
 {
     _logger          = logger;
     _paramRepository = paramRepository;
 }
 public ParamController(IParamRepository repository)
 {
     _repository = repository;
 }
Пример #7
0
 public Api(IContentFactory contentFactory, IAliasRepository aliasRepository, IArchiveRepository archiveRepository, IMediaRepository mediaRepository, IPageRepository pageRepository, IPageTypeRepository pageTypeRepository, IParamRepository paramRepository, IPostRepository postRepository, IPostTypeRepository postTypeRepository, ISiteRepository siteRepository, ISiteTypeRepository siteTypeRepository, ICache cache = null, IStorage storage = null, IImageProcessor processor = null, ISearch search = null)
 {
     base();
     this._cache = cache;
     this.u003cPageTypesu003ek__BackingField = new PageTypeService(pageTypeRepository, cache);
     this.u003cParamsu003ek__BackingField    = new ParamService(paramRepository, cache);
     this.u003cPostTypesu003ek__BackingField = new PostTypeService(postTypeRepository, cache);
     this.u003cSitesu003ek__BackingField     = new SiteService(siteRepository, contentFactory, cache);
     this.u003cSiteTypesu003ek__BackingField = new SiteTypeService(siteTypeRepository, cache);
     this.u003cAliasesu003ek__BackingField   = new AliasService(aliasRepository, this.get_Sites(), cache);
     this.u003cMediau003ek__BackingField     = new MediaService(mediaRepository, this.get_Params(), storage, processor, cache);
     this.u003cPagesu003ek__BackingField     = new PageService(pageRepository, contentFactory, this.get_Sites(), this.get_Params(), this.get_Media(), cache, search);
     this.u003cPostsu003ek__BackingField     = new PostService(postRepository, contentFactory, this.get_Sites(), this.get_Pages(), this.get_Params(), this.get_Media(), cache, search);
     this.u003cArchivesu003ek__BackingField  = new ArchiveService(archiveRepository, this.get_Params(), this.get_Posts());
     return;
 }