Esempio n. 1
0
        /// <summary>
        /// Configures the api.
        /// </summary>
        /// <param name="modelCache">The optional model cache</param>
        private void Setup(ICache modelCache = null)
        {
            cache = modelCache;

            Media     = new Repositories.MediaRepository(conn, storage);
            Pages     = new Repositories.PageRepository(this, conn, cache);
            PageTypes = new Repositories.PageTypeRepository(conn, cache);
            Params    = new Repositories.ParamRepository(conn, cache);
            Sites     = new Repositories.SiteRepository(conn, cache);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a new API on an already open session.
        /// </summary>
        /// <param name="session">The session</param>
        internal Api(Data.ISession session)
        {
            this.session = session != null ? session : App.Store.OpenSession();
            isExternal   = session != null;

            Aliases    = new Repositories.AliasRepository(this.session);
            Authors    = new Repositories.AuthorRepository(this.session);
            Blocks     = new Repositories.BlockRepository(this.session);
            Categories = new Repositories.CategoryRepository(this.session);
            Comments   = new Repositories.CommentRepository(this.session);
            Media      = new Repositories.MediaRepository(this.session);
            Pages      = new Repositories.PageRepository(this.session);
            PageTypes  = new Repositories.PageTypeRepository(this.session);
            Params     = new Repositories.ParamRepository(this.session);
            Posts      = new Repositories.PostRepository(this.session);
            PostTypes  = new Repositories.PostTypeRepository(this.session);
            Ratings    = new Repositories.RatingRepository(this.session);
        }