Exemplo n.º 1
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(ContentDetailsViewModel viewModel)
        {
            if (this.ContentType != null)
            {
                var contentResolvedType = this.ContentType;
                var result = new List <CacheDependencyKey>(1);
                if (viewModel.Item != null && viewModel.Item.Fields.Id != Guid.Empty)
                {
                    result.AddRange(OutputCacheDependencyHelper.GetPublishedContentCacheDependencyKeys(contentResolvedType, viewModel.Item.Fields.Id));
                }

                this.AddCommonDependencies(result, this.ContentType, viewModel.Item);

                return(result);
            }
            else
            {
                return(new List <CacheDependencyKey>(0));
            }
        }
Exemplo n.º 2
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(ContentDetailsViewModel viewModel)
        {
            if (this.ContentType != null)
            {
                var contentResolvedType = this.ContentType;
                var result = new List <CacheDependencyKey>(1);
                if (viewModel.Item != null && viewModel.Item.Fields.Id != Guid.Empty)
                {
                    result.Add(new CacheDependencyKey {
                        Key = viewModel.Item.Fields.Id.ToString(), Type = contentResolvedType
                    });
                }

                return(result);
            }
            else
            {
                return(new List <CacheDependencyKey>(0));
            }
        }
        /// <inheritdoc />
        public override IList<CacheDependencyKey> GetKeysOfDependentObjects(ContentDetailsViewModel viewModel)
        {
            if (this.ContentType != null)
            {
                var result = new List<CacheDependencyKey>(1);
                if (viewModel.Item != null && viewModel.Item.Fields.Id != Guid.Empty)
                {
                    result.Add(new CacheDependencyKey { Key = viewModel.Item.Fields.Id.ToString().ToUpperInvariant(), Type = typeof(Telerik.Sitefinity.DynamicModules.Model.DynamicContent) });
                }

                return result;
            }
            else
            {
                return new List<CacheDependencyKey>(0);
            }
        }