예제 #1
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="api">The current api</param>
 /// <param name="db">The current db context</param>
 /// <param name="factory">The content service factory</param>
 /// <param name="cache">The optional model cache</param>
 public PageRepository(IApi api, IDb db, IContentServiceFactory factory, ICache cache = null)
 {
     _api            = api;
     _db             = db;
     _contentService = factory.CreatePageService();
     _cache          = cache;
 }
예제 #2
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="api">The current api</param>
 /// <param name="db">The current db connection</param>
 /// <param name="factory">The current content service factory</param>
 /// <param name="cache">The optional model cache</param>
 public PostRepository(IApi api, IDb db, IContentServiceFactory factory, ICache cache = null)
 {
     this.db             = db;
     this.api            = api;
     this.contentService = factory.CreatePostService();
     this.cache          = cache;
 }
예제 #3
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="db">The current db context</param>
        /// <param name="factory">The content service factory</param>
        /// <param name="storage">The current storage</param>
        /// <param name="modelCache">The optional model cache</param>
        /// <param name="imageProcessor">The optional image processor</param>
        public Api(IDb db, IContentServiceFactory factory, IStorage storage = null, ICache modelCache = null, IImageProcessor imageProcessor = null)
        {
            _db      = db;
            _storage = storage;

            Setup(factory, modelCache, imageProcessor);
        }
예제 #4
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(IContentServiceFactory factory, ICache modelCache = null, IImageProcessor imageProcessor = null)
        {
            cache = modelCache;

            var cacheLevel = (int)App.CacheLevel;

            Aliases    = new AliasRepository(this, db, cacheLevel > 2 ? cache : null);
            Archives   = new ArchiveRepository(this, db);
            Categories = new CategoryRepository(this, db, cacheLevel > 2 ? cache : null);
            Media      = new MediaRepository(this, db, storage, cacheLevel > 2 ? cache : null, imageProcessor);
            Pages      = new PageRepository(this, db, factory, cacheLevel > 2 ? cache : null);
            PageTypes  = new PageTypeRepository(db, cacheLevel > 1 ? cache : null);
            Params     = new ParamRepository(db, cacheLevel > 0 ? cache : null);
            Posts      = new PostRepository(this, db, factory, cacheLevel > 2 ? cache : null);
            PostTypes  = new PostTypeRepository(db, cacheLevel > 1 ? cache : null);
            Sites      = new SiteRepository(this, db, cacheLevel > 0 ? cache : null);
            Tags       = new TagRepository(db, cacheLevel > 2 ? cache : null);
        }
예제 #5
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="db">The current db connection</param>
 /// <param name="factory">The content service factory</param>
 public ContentRepository(IDb db, IContentServiceFactory factory)
 {
     _db      = db;
     _service = factory.CreateContentService();
 }
예제 #6
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="api">The current api</param>
 /// <param name="editService">The current page edit service</param>
 /// <param name="factory">The content service factory</param>
 public PageController(IApi api, PageEditService editService, IContentServiceFactory factory) : base(api)
 {
     this.editService    = editService;
     this.contentService = factory.CreatePageService();
 }
예제 #7
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="api">The current api</param>
 /// <param name="factory">The content service factory</param>
 public BlockController(IApi api, IContentServiceFactory factory) : base(api)
 {
     // Block transformation is not dependent on which content
     // type is actually selected, so let's create a page service.
     this.contentService = factory.CreatePageService();
 }
예제 #8
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="api">The current api</param>
 public PostController(IApi api, PostEditService editService, IContentServiceFactory factory, IHubContext <Hubs.PreviewHub> hub) : base(api)
 {
     this.editService    = editService;
     this.contentService = factory.CreatePostService();
     _hub = hub;
 }
예제 #9
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="db">The current db context</param>
 /// <param name="factory">The content service factory</param>
 public SiteRepository(IDb db, IContentServiceFactory factory)
 {
     _db             = db;
     _contentService = factory.CreateSiteService();
 }
예제 #10
0
 public PageEditService(IApi api, IContentServiceFactory factory)
 {
     _api     = api;
     _service = factory.CreatePageService();
 }
 public SiteContentEditService(IApi api, IContentServiceFactory factory)
 {
     this.api = api;
     service  = factory.CreateSiteService();
 }
예제 #12
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="api">The current api</param>
 /// <param name="db">The current db context</param>
 /// <param name="factory">The content service factory</param>
 /// <param name="cache">The optional model cache</param>
 public SiteRepository(Api api, IDb db, IContentServiceFactory factory, ICache cache = null)
     : base(db, cache)
 {
     this.api            = api;
     this.contentService = factory.CreateSiteService();
 }
 public ExtendedPageRepository(IDb db, IContentServiceFactory factory) : base(db, factory)
 {
     _db = db;
 }
예제 #14
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="api">The current api</param>
 /// <param name="db">The current db context</param>
 /// <param name="factory">The content service factory</param>
 /// <param name="cache">The optional model cache</param>
 public SiteRepository(Api api, IDb db, IContentServiceFactory factory, ICache cache = null)
     : base(db, cache)
 {
     this.api            = api;
     this.contentService = factory.Create <Site, SiteField, Models.SiteContentBase>();
 }
예제 #15
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="api">The current api</param>
 public SiteController(IApi api, SiteContentEditService service, IContentServiceFactory factory) : base(api)
 {
     _service        = service;
     _contentService = factory.CreateSiteService();
 }
예제 #16
0
 public PageRepository(ISessionFactory sessionFactory, IContentServiceFactory factory, IMapper mapper) : base(sessionFactory)
 {
     _contentService = factory.CreatePageService();
     _mapper         = mapper;
 }
예제 #17
0
 public PostEditService(IApi api, IContentServiceFactory factory)
 {
     this.api = api;
     service  = factory.CreatePostService();
 }
예제 #18
0
 public SiteRepository(ISessionFactory sessionFactory, IContentServiceFactory factory) : base(sessionFactory)
 {
     _contentService = factory.CreateSiteService();
 }
예제 #19
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="db">The current db connection</param>
 /// <param name="factory">The current content service factory</param>
 public PostRepository(IDb db, IContentServiceFactory factory)
 {
     _db             = db;
     _contentService = factory.CreatePostService();
 }
예제 #20
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="api">The current api</param>
 /// <param name="editService">The current page edit service</param>
 /// <param name="factory">The content service factory</param>
 public PageController(IApi api, PageEditService editService, IContentServiceFactory factory, IHubContext <Hubs.PreviewHub> hub) : base(api)
 {
     _editService    = editService;
     _contentService = factory.CreatePageService();
     _hub            = hub;
 }