/// <summary> /// Constructor on <see cref="EPostListQueryType"/> and optional rootId. /// </summary> /// <exception cref="FanException"> /// If query is for child pages, then rootId must be a non zero value. /// https://msdn.microsoft.com/en-us/library/ms229060(v=vs.110).aspx /// </exception> public PostListQuery(EPostListQueryType queryType, int?id = null) { if (queryType == EPostListQueryType.ChildPagesForRoot) { RootId = id; } else if (queryType == EPostListQueryType.ChildPagesForParent) { ParentId = id; } QueryType = queryType; if ((id == null || id <= 0) && queryType == EPostListQueryType.ChildPagesForRoot) { throw new ArgumentException($"Invalid id '{id}'. A query for child pages must have a valid root id."); } else if ((id == null || id <= 0) && queryType == EPostListQueryType.ChildPagesForParent) { throw new ArgumentException($"Invalid id '{id}'. A query for child pages must have a valid parent id."); } }
public PostListQuery(EPostListQueryType queryType) { QueryType = queryType; }