Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Root.Core.Models.GlobalFields.PageData
- {
- using System;
- using System.Collections.Generic;
- using Deliverystack.Core.Models.Repositories;
- using Root.Core.Models.Controls;
- using Root.Core.Models.Entries.Author;
- using Root.Core.Models.Fields;
- public class PageDataField
- {
- //require repository
- private PageDataField()
- {
- }
- public PageDataField(IRepository repository)
- {
- Repository = repository;
- }
- public IRepository Repository { get; set; }
- public string Title { get; set; }
- private string _shortTitle = null;
- public string ShortTitle
- {
- get
- {
- if (String.IsNullOrEmpty(_shortTitle))
- {
- _shortTitle = Title;
- }
- return _shortTitle;
- }
- set
- {
- _shortTitle = value;
- }
- }
- public string Keywords { get; set; }
- public string Description { get; set; }
- public List<ReferenceField<AuthorEntry>> Authors { get; set; }
- //public List<AuthorEntry> Authors { get; set; }
- // nullable to support deserialization of empty value
- public ChangeFrequency? ChangeFrequency { get; set; } = Controls.ChangeFrequency.Never;
- // nullable to support deserialization of empty value
- public double? Priority { get; set; } = double.MinValue;
- public bool ExcludeFromSitemap { get; set; }
- public string View { get; set; }
- public string PartialView { get; set; }
- }
- }
- //TODO: public List<Entry> Children { get; set; }
- //TODO: Initialize() could do the following for all List<T> where T : EntryModel?
- // alternative approach where Authors is List<AuthorEntry>
- // in which case Entries have only UID and CTUID.
- // to implement as a property, pass repository some other way
- /* public AuthorEntry[] GetAuthors(IRepository repository)
- {
- if (Authors == null || Authors.Count < 1)
- {
- return new AuthorEntry[0];
- }
- if (!_authorsFetched)
- {
- for (int i = 0; i < Authors.Count; i++)
- {
- Authors[i] =
- repository.Get<AuthorEntry>(Authors[i].EntryUid, Authors[i].ContentTypeUid);
- }
- }
- return Authors.ToArray();
- }*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement