Cherry-pick of #20129 to 16.
This commit is contained in:
@@ -24,6 +24,8 @@ public interface IPublishedContentQuery
|
||||
|
||||
IEnumerable<IPublishedContent> ContentAtRoot();
|
||||
|
||||
IEnumerable<IPublishedContent> ContentAtRoot(string? culture) => culture is null ? ContentAtRoot() : throw new NotSupportedException();
|
||||
|
||||
IPublishedContent? Media(int id);
|
||||
|
||||
IPublishedContent? Media(Guid id);
|
||||
|
||||
@@ -144,6 +144,9 @@ public class PublishedContentQuery : IPublishedContentQuery
|
||||
public IEnumerable<IPublishedContent> ContentAtRoot()
|
||||
=> ItemsAtRoot(_publishedContent);
|
||||
|
||||
public IEnumerable<IPublishedContent> ContentAtRoot(string? culture)
|
||||
=> ItemsAtRoot(_publishedContent, culture);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Media
|
||||
@@ -212,8 +215,8 @@ public class PublishedContentQuery : IPublishedContentQuery
|
||||
private IEnumerable<IPublishedContent> ItemsByIds(IPublishedCache? cache, IEnumerable<Guid> ids)
|
||||
=> ids.Select(eachId => ItemById(eachId, cache)).WhereNotNull();
|
||||
|
||||
private static IEnumerable<IPublishedContent> ItemsAtRoot(IPublishedCache? cache)
|
||||
=> cache?.GetAtRoot() ?? Array.Empty<IPublishedContent>();
|
||||
private static IEnumerable<IPublishedContent> ItemsAtRoot(IPublishedCache? cache, string? culture = null)
|
||||
=> cache?.GetAtRoot(culture) ?? Array.Empty<IPublishedContent>();
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -347,7 +347,7 @@ public static class FriendlyPublishedContentExtensions
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// This can be useful in order to return all nodes in an entire site by a type when combined with TypedContentAtRoot
|
||||
/// This can be useful in order to return all nodes in an entire site by a type when combined with ContentAtRoot.
|
||||
/// </remarks>
|
||||
public static IEnumerable<IPublishedContent> DescendantsOrSelfOfType(
|
||||
this IEnumerable<IPublishedContent> parentNodes, string docTypeAlias, string? culture = null)
|
||||
@@ -375,7 +375,7 @@ public static class FriendlyPublishedContentExtensions
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// This can be useful in order to return all nodes in an entire site by a type when combined with TypedContentAtRoot
|
||||
/// This can be useful in order to return all nodes in an entire site by a type when combined with ContentAtRoot.
|
||||
/// </remarks>
|
||||
public static IEnumerable<T> DescendantsOrSelf<T>(
|
||||
this IEnumerable<IPublishedContent> parentNodes,
|
||||
|
||||
Reference in New Issue
Block a user