Cleanup IPublishedCache.GetByContentType
This commit is contained in:
@@ -546,13 +546,6 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
return _contentTypeCache.Get(PublishedItemType.Content, alias);
|
||||
}
|
||||
|
||||
public override IEnumerable<IPublishedContent> GetByContentType(PublishedContentType contentType)
|
||||
{
|
||||
return GetAtRoot()
|
||||
.SelectMany(x => x.DescendantsOrSelf())
|
||||
.Where(x => x.ContentType == contentType);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -620,7 +620,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
|
||||
public override IEnumerable<IPublishedContent> GetByContentType(PublishedContentType contentType)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -208,7 +208,12 @@ namespace Umbraco.Web.PublishedCache
|
||||
/// <returns>The content type, or null.</returns>
|
||||
/// <remarks>The alias is case-insensitive.</remarks>
|
||||
PublishedContentType GetContentType(string alias);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets contents of a given content type.
|
||||
/// </summary>
|
||||
/// <param name="contentType">The content type.</param>
|
||||
/// <returns>The contents.</returns>
|
||||
IEnumerable<IPublishedContent> GetByContentType(PublishedContentType contentType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,13 +386,6 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
return _snapshot.GetContentType(alias);
|
||||
}
|
||||
|
||||
public override IEnumerable<IPublishedContent> GetByContentType(PublishedContentType contentType)
|
||||
{
|
||||
return GetAtRoot()
|
||||
.SelectMany(x => x.DescendantsOrSelf())
|
||||
.Where(x => x.ContentType == contentType);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
@@ -166,11 +166,6 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
return _snapshot.GetContentType(alias);
|
||||
}
|
||||
|
||||
public override IEnumerable<IPublishedContent> GetByContentType(PublishedContentType contentType)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.XPath;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Xml;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Web.PublishedCache
|
||||
{
|
||||
@@ -92,6 +92,13 @@ namespace Umbraco.Web.PublishedCache
|
||||
|
||||
public abstract PublishedContentType GetContentType(string alias);
|
||||
|
||||
public abstract IEnumerable<IPublishedContent> GetByContentType(PublishedContentType contentType);
|
||||
public virtual IEnumerable<IPublishedContent> GetByContentType(PublishedContentType contentType)
|
||||
{
|
||||
// this is probably not super-efficient, but works
|
||||
// some cache implementation may want to override it, though
|
||||
return GetAtRoot()
|
||||
.SelectMany(x => x.DescendantsOrSelf())
|
||||
.Where(x => x.ContentType.Id == contentType.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user