/// <summary> /// Gets a collection of <see cref="CacheDependencyNotifiedObject"/>. /// The <see cref="CacheDependencyNotifiedObject"/> represents a key for which cached items could be subscribed for /// notification. /// When notified, all cached objects with dependency on the provided keys will expire. /// </summary> /// <param name="viewModel">View model that will be used for displaying the data.</param> /// <returns> /// The <see cref="IList"/>. /// </returns> public virtual IList <CacheDependencyKey> GetKeysOfDependentObjects(ContentListViewModel viewModel) { if (this.ContentType != null) { var contentResolvedType = this.ContentType; var result = new List <CacheDependencyKey>(1); var manager = this.GetManager(); var provider = manager != null ? manager.Provider : null; string applicationName = provider != null ? provider.ApplicationName : string.Empty; if (typeof(ILifecycleDataItem).IsAssignableFrom(this.ContentType)) { result.Add(new CacheDependencyKey { Key = string.Concat(ContentLifecycleStatus.Live.ToString(), applicationName), Type = contentResolvedType }); } else { result.Add(new CacheDependencyKey { Key = applicationName, Type = contentResolvedType }); } this.AddCommonDependencies(result, this.ContentType); return(result); } else { return(new List <CacheDependencyKey>(0)); } }
/// <summary> /// Sets the view model properties. /// </summary> /// <param name="viewModel">The view model.</param> /// <param name="page">The page.</param> /// <param name="totalPages">The total pages.</param> protected virtual void SetViewModelProperties(ContentListViewModel viewModel, int page, int?totalPages) { viewModel.CurrentPage = page; viewModel.TotalPagesCount = totalPages; viewModel.ProviderName = this.ProviderName; viewModel.ContentType = this.ContentType; viewModel.CssClass = this.ListCssClass; viewModel.ShowPager = this.DisplayMode == ListDisplayMode.Paging && totalPages.HasValue && totalPages > 1; }
/// <inheritdoc /> public override IList<CacheDependencyKey> GetKeysOfDependentObjects(ContentListViewModel viewModel) { if (this.ContentType != null) { var result = new List<CacheDependencyKey>(1); result.Add(new CacheDependencyKey { Key = this.ContentType.FullName, Type = typeof(Telerik.Sitefinity.DynamicModules.Model.DynamicContent) }); return result; } else { return new List<CacheDependencyKey>(0); } }
/// <summary> /// Gets a collection of <see cref="CacheDependencyNotifiedObject"/>. /// The <see cref="CacheDependencyNotifiedObject"/> represents a key for which cached items could be subscribed for /// notification. /// When notified, all cached objects with dependency on the provided keys will expire. /// </summary> /// <param name="viewModel">View model that will be used for displaying the data.</param> /// <returns> /// The <see cref="IList"/>. /// </returns> public virtual IList <CacheDependencyKey> GetKeysOfDependentObjects(ContentListViewModel viewModel) { if (this.ContentType != null) { var contentResolvedType = this.ContentType; var result = new List <CacheDependencyKey>(1); result.Add(new CacheDependencyKey { Key = null, Type = contentResolvedType }); return(result); } else { return(new List <CacheDependencyKey>(0)); } }
/// <summary> /// Gets a collection of <see cref="CacheDependencyNotifiedObject"/>. /// The <see cref="CacheDependencyNotifiedObject"/> represents a key for which cached items could be subscribed for /// notification. /// When notified, all cached objects with dependency on the provided keys will expire. /// </summary> /// <param name="viewModel">View model that will be used for displaying the data.</param> /// <returns> /// The <see cref="IList"/>. /// </returns> public virtual IList <CacheDependencyKey> GetKeysOfDependentObjects(ContentListViewModel viewModel) { if (this.ContentType != null) { var contentResolvedType = this.ContentType; var result = new List <CacheDependencyKey>(1); var manager = this.GetManager(); string applicationName = manager != null && manager.Provider != null ? manager.Provider.ApplicationName : string.Empty; result.Add(new CacheDependencyKey { Key = string.Concat(ContentLifecycleStatus.Live.ToString(), applicationName), Type = contentResolvedType }); return(result); } else { return(new List <CacheDependencyKey>(0)); } }
/// <summary> /// Gets a collection of <see cref="CacheDependencyNotifiedObject"/>. /// The <see cref="CacheDependencyNotifiedObject"/> represents a key for which cached items could be subscribed for /// notification. /// When notified, all cached objects with dependency on the provided keys will expire. /// </summary> /// <param name="viewModel">View model that will be used for displaying the data.</param> /// <returns> /// The <see cref="IList"/>. /// </returns> public virtual IList <CacheDependencyKey> GetKeysOfDependentObjects(ContentListViewModel viewModel) { if (this.ContentType != null) { var contentResolvedType = this.ContentType; var result = new List <CacheDependencyKey>(1); var manager = this.GetManager(); var provider = manager != null ? manager.Provider : null; string applicationName = provider != null ? provider.ApplicationName : string.Empty; result.AddRange(OutputCacheDependencyHelper.GetPublishedContentCacheDependencyKeys(contentResolvedType, applicationName)); this.AddCommonDependencies(result, this.ContentType); return(result); } else { return(new List <CacheDependencyKey>(0)); } }
/// <summary> /// Populates the list ViewModel. /// </summary> /// <param name="page">The current page.</param> /// <param name="query">The query.</param> /// <param name="viewModel">The view model.</param> protected virtual void PopulateListViewModel(int page, IQueryable <IDataItem> query, ContentListViewModel viewModel) { int?totalPages = null; if (this.SelectionMode == Models.SelectionMode.SelectedItems && (this.selectedItemsIds.Count == 0 || string.IsNullOrEmpty(this.GetSelectedItemsFilterExpression()))) { viewModel.Items = Enumerable.Empty <ItemViewModel>(); } else { viewModel.Items = this.ApplyListSettings(page, query, out totalPages); } this.SetViewModelProperties(viewModel, page, totalPages); }
/// <summary> /// Populates the list ViewModel. /// </summary> /// <param name="page">The current page.</param> /// <param name="query">The query.</param> /// <param name="viewModel">The view model.</param> protected virtual void PopulateListViewModel(int page, IQueryable <IDataItem> query, ContentListViewModel viewModel) { viewModel.CurrentPage = page; int?totalPages = null; if (this.SelectionMode == Models.SelectionMode.SelectedItems && this.selectedItemsIds.Count == 0) { viewModel.Items = Enumerable.Empty <ItemViewModel>(); } else { viewModel.Items = this.ApplyListSettings(page, query, out totalPages); viewModel.TotalPagesCount = totalPages; } viewModel.TotalPagesCount = totalPages; viewModel.ProviderName = this.ProviderName; viewModel.ContentType = this.ContentType; viewModel.CssClass = this.ListCssClass; viewModel.ShowPager = this.DisplayMode == ListDisplayMode.Paging && totalPages.HasValue && totalPages > 1; }