コード例 #1
0
        public ForumThread(Entity entity, IPortalViewEntity viewEntity, IForumThreadInfo threadInfo, Func <int> postCount, string url = null)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            if (viewEntity == null)
            {
                throw new ArgumentNullException("viewEntity");
            }
            if (threadInfo == null)
            {
                throw new ArgumentNullException("threadInfo");
            }
            if (postCount == null)
            {
                throw new ArgumentNullException("postCount");
            }

            Entity      = entity;
            _viewEntity = viewEntity;

            Author     = threadInfo.Author;
            LatestPost = threadInfo.LatestPost;
            PostedOn   = threadInfo.PostedOn;
            Tags       = threadInfo.Tags;
            ThreadType = threadInfo.ThreadType;

            _postCount = new Lazy <int>(postCount);
            _url       = url;

            Name       = entity.GetAttributeValue <string>("adx_name");
            IsAnswered = entity.GetAttributeValue <bool?>("adx_isanswered").GetValueOrDefault();
            IsSticky   = entity.GetAttributeValue <bool?>("adx_sticky").GetValueOrDefault();
            Locked     = entity.GetAttributeValue <bool?>("adx_locked").GetValueOrDefault();
        }
コード例 #2
0
 public ForumThread(Entity entity, IPortalViewEntity viewEntity, IForumThreadInfo threadInfo, int postCount, string url = null)
     : this(entity, viewEntity, threadInfo, () => postCount, url)
 {
 }