Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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();
 }
Exemplo n.º 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();
 }
Exemplo n.º 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();
 }
Exemplo n.º 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;
 }
Exemplo n.º 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();
 }
Exemplo n.º 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();
 }
Exemplo n.º 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;
 }
Exemplo n.º 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>();
 }
Exemplo n.º 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();
 }
Exemplo n.º 16
0
 public PageRepository(ISessionFactory sessionFactory, IContentServiceFactory factory, IMapper mapper) : base(sessionFactory)
 {
     _contentService = factory.CreatePageService();
     _mapper         = mapper;
 }
Exemplo n.º 17
0
 public PostEditService(IApi api, IContentServiceFactory factory)
 {
     this.api = api;
     service  = factory.CreatePostService();
 }
Exemplo n.º 18
0
 public SiteRepository(ISessionFactory sessionFactory, IContentServiceFactory factory) : base(sessionFactory)
 {
     _contentService = factory.CreateSiteService();
 }
Exemplo n.º 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();
 }
Exemplo n.º 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;
 }