Beispiel #1
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public Api(Db db)
        {
            this.db = db;

            Archives   = new Repositories.ArchiveRepository(db);
            Categories = new Repositories.CategoryRepository(db);
            Pages      = new Repositories.PageRepository(db);
            Posts      = new Repositories.PostRepository(db);
            SiteMap    = new Repositories.SiteMapRepository(db);
        }
Beispiel #2
0
        /// <summary>
        /// Configures the api.
        /// </summary>
        /// <param name="modelCache">The optional model cache</param>
        private void Setup(ICache modelCache = null)
        {
            cache = modelCache;

            Archives   = new Repositories.ArchiveRepository(this, db);
            Categories = new Repositories.CategoryRepository(this, db, cache);
            Media      = new Repositories.MediaRepository(db, storage, cache);
            Pages      = new Repositories.PageRepository(this, db, cache);
            PageTypes  = new Repositories.PageTypeRepository(db, cache);
            Params     = new Repositories.ParamRepository(db, cache);
            Posts      = new Repositories.PostRepository(this, db, cache);
            PostTypes  = new Repositories.PostTypeRepository(db, cache);
            Sites      = new Repositories.SiteRepository(this, db, cache);
            Tags       = new Repositories.TagRepository(db, cache);
        }
Beispiel #3
0
        /// <summary>
        /// Configures the api.
        /// </summary>
        /// <param name="modelCache">The optional model cache</param>
        /// <param name="imageProcessor">The optional image processor</param>
        private void Setup(ICache modelCache = null, IImageProcessor imageProcessor = null)
        {
            cache = modelCache;

            var cacheLevel = (int)App.CacheLevel;

            Aliases    = new Repositories.AliasRepository(this, db, cacheLevel > 2 ? cache : null);
            Archives   = new Repositories.ArchiveRepository(this, db);
            Categories = new Repositories.CategoryRepository(this, db, cacheLevel > 2 ? cache : null);
            Media      = new Repositories.MediaRepository(this, db, storage, cacheLevel > 2 ? cache : null, imageProcessor);
            Pages      = new Repositories.PageRepository(this, db, services, cacheLevel > 2 ? cache : null);
            PageTypes  = new Repositories.PageTypeRepository(db, cacheLevel > 1 ? cache : null);
            Params     = new Repositories.ParamRepository(db, cacheLevel > 0 ? cache : null);
            Posts      = new Repositories.PostRepository(this, db, services, cacheLevel > 2 ? cache : null);
            PostTypes  = new Repositories.PostTypeRepository(db, cacheLevel > 1 ? cache : null);
            Sites      = new Repositories.SiteRepository(this, db, cacheLevel > 0 ? cache : null);
            Tags       = new Repositories.TagRepository(db, cacheLevel > 2 ? cache : null);
        }