From f1f32a18a3578d718c888a0712ce9e7e728ae097 Mon Sep 17 00:00:00 2001 From: Sean Wright Date: Sat, 1 Jan 2022 20:46:40 -0500 Subject: [PATCH] fix(MultiDocumentQueryExtensions): add missing ToListAsync overload --- ...ommunityDocumentMaterializationExtensions.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/XperienceCommunity.QueryExtensions/Documents/XperienceCommunityDocumentMaterializationExtensions.cs b/src/XperienceCommunity.QueryExtensions/Documents/XperienceCommunityDocumentMaterializationExtensions.cs index d163147..065aa5f 100644 --- a/src/XperienceCommunity.QueryExtensions/Documents/XperienceCommunityDocumentMaterializationExtensions.cs +++ b/src/XperienceCommunity.QueryExtensions/Documents/XperienceCommunityDocumentMaterializationExtensions.cs @@ -54,6 +54,23 @@ public static async Task> ToListAsync(this MultiDocumentQuery qu return result.ToList(); } + /// + /// Converts the to a of + /// + /// The current MultiDocumentQuery + /// Mapping function from to + /// Optional cancellation token + /// + public static async Task> ToListAsync( + this MultiDocumentQuery query, + Func projection, + CancellationToken token = default) + { + var result = await query.GetEnumerableTypedResultAsync(cancellationToken: token); + + return result.Select(projection).ToList(); + } + /// /// Returns the first item of the as the generic Page type and null if no items were returned. ///