/// <summary> /// Constructor. /// </summary> /// <param name="ideaForum">The idea forum to get and set data for.</param> /// <param name="dependencies">The dependencies to use for getting and setting data.</param> public IdeaForumDataAdapter(EntityReference ideaForum, IDataAdapterDependencies dependencies) { ideaForum.ThrowOnNull("ideaForum"); ideaForum.AssertLogicalName("adx_ideaforum"); dependencies.ThrowOnNull("dependencies"); IdeaForum = ideaForum; Dependencies = dependencies; }
/// <summary> /// Initializes a new instance of the <see cref="CategoryDataAdapter"/> class. /// </summary> /// <param name="category">Category Entity Reference</param> /// <param name="dependencies">Data Adapter Dependencies</param> public CategoryDataAdapter(EntityReference category, KnowledgeArticles.IDataAdapterDependencies dependencies) { category.ThrowOnNull("article"); category.AssertLogicalName("knowledgearticle"); dependencies.ThrowOnNull("dependencies"); this.Category = category; this.Dependencies = dependencies; }
/// <summary> /// Constructor. /// </summary> /// <param name="idea">The idea to get and set data for.</param> /// <param name="dependencies">The dependencies to use for getting and setting data.</param> public IdeaDataAdapter(EntityReference idea, IDataAdapterDependencies dependencies) { idea.ThrowOnNull("idea"); idea.AssertLogicalName("adx_idea"); dependencies.ThrowOnNull("dependencies"); Idea = idea; Dependencies = dependencies; }
/// <summary> /// Constructor. /// </summary> /// <param name="issue">The issue to get and set data for.</param> /// <param name="dependencies">The dependencies to use for getting and setting data.</param> public IssueDataAdapter(EntityReference issue, IDataAdapterDependencies dependencies) { issue.ThrowOnNull("issue"); issue.AssertLogicalName("adx_issue"); dependencies.ThrowOnNull("dependencies"); Issue = issue; Dependencies = dependencies; }
/// <summary> /// Constructor. /// </summary> /// <param name="article">Knowledge Article Entity Reference</param> /// <param name="code">Article language code</param> /// <param name="dependencies">Data Adapter Dependencies</param> public KnowledgeArticleDataAdapter(EntityReference article, string code, IDataAdapterDependencies dependencies) { article.ThrowOnNull("article"); article.AssertLogicalName("knowledgearticle"); dependencies.ThrowOnNull("dependencies"); this.KnowledgeArticle = article; this.Dependencies = dependencies; this.LanguageCode = code; }
/// <summary> /// Constructor. /// </summary> /// <param name="issueForum">The issue forum to get and set data for.</param> /// <param name="dependencies">The dependencies to use for getting and setting data.</param> public IssueForumDataAdapter(EntityReference issueForum, IDataAdapterDependencies dependencies) { issueForum.ThrowOnNull("issueForum"); issueForum.AssertLogicalName("adx_issueforum"); dependencies.ThrowOnNull("dependencies"); IssueForum = issueForum; Dependencies = dependencies; Status = new int[] { }; }
public void UpdateLatestPost(EntityReference forumPost, bool incremementForumThreadCount = false) { if (forumPost == null) { throw new ArgumentNullException("forumPost"); } forumPost.AssertLogicalName("adx_communityforumpost"); ADXTrace.Instance.TraceInfo(TraceCategory.Application, string.Format("Forum={0}: Start", Forum.Id)); var serviceContext = Dependencies.GetServiceContextForWrite(); var forumEntity = SelectForumEntity(serviceContext, Forum); var forumUpdate = new Entity("adx_communityforum") { Id = forumEntity.Id }; forumUpdate["adx_lastpostid"] = forumPost; var counterStrategy = Dependencies.GetCounterStrategy(); var forumCounts = counterStrategy.GetForumCounts(serviceContext, forumEntity); forumUpdate["adx_postcount"] = forumCounts.PostCount + 1; if (incremementForumThreadCount) { forumUpdate["adx_threadcount"] = forumCounts.ThreadCount + 1; } // Update forum count but skip cache invalidation. (serviceContext as IOrganizationService).ExecuteUpdate(forumUpdate, RequestFlag.ByPassCacheInvalidation); if (FeatureCheckHelper.IsFeatureEnabled(FeatureNames.TelemetryFeatureUsage)) { PortalFeatureTrace.TraceInstance.LogFeatureUsage(FeatureTraceCategory.Forum, HttpContext.Current, "edit_forum_thread", 1, forumPost, "edit"); } ADXTrace.Instance.TraceInfo(TraceCategory.Application, string.Format("Forum={0}: End", Forum.Id)); }