From 8ebf8e3d27fa801910da507f1ae618bc4ec41576 Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Thu, 28 Mar 2024 14:41:50 -0700 Subject: [PATCH] Improve the Pager extensions (#15617) --- .../ShapeFactoryExtensions.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/OrchardCore/OrchardCore.Navigation.Core/ShapeFactoryExtensions.cs b/src/OrchardCore/OrchardCore.Navigation.Core/ShapeFactoryExtensions.cs index 62c08f92a77..03d64bc33e9 100644 --- a/src/OrchardCore/OrchardCore.Navigation.Core/ShapeFactoryExtensions.cs +++ b/src/OrchardCore/OrchardCore.Navigation.Core/ShapeFactoryExtensions.cs @@ -8,7 +8,7 @@ namespace OrchardCore.DisplayManagement; public static class ShapeFactoryExtensions { public static ValueTask PagerAsync(this IShapeFactory _shapeFactory, Pager pager, int totalItemCount) - => _shapeFactory.CreateAsync("Pager", Arguments.From(new + => _shapeFactory.CreateAsync(nameof(Pager), Arguments.From(new { pager.Page, pager.PageSize, @@ -17,11 +17,11 @@ public static ValueTask PagerAsync(this IShapeFactory _shapeFactory, Pag public static async ValueTask PagerAsync(this IShapeFactory _shapeFactory, Pager pager, int totalItemCount, RouteData routeData) { - dynamic pagerShape = await _shapeFactory.PagerAsync(pager, totalItemCount); + var pagerShape = await _shapeFactory.PagerAsync(pager, totalItemCount); if (routeData != null) { - pagerShape.RouteData(routeData); + pagerShape.Properties[nameof(RouteData)] = routeData; } return pagerShape; @@ -31,7 +31,7 @@ public static ValueTask PagerAsync(this IShapeFactory _shapeFactory, Pag => _shapeFactory.PagerAsync(pager, totalItemCount, routeValues == null ? null : new RouteData(routeValues)); public static ValueTask PagerSlimAsync(this IShapeFactory _shapeFactory, PagerSlim pager) - => _shapeFactory.CreateAsync("PagerSlim", Arguments.From(new + => _shapeFactory.CreateAsync(nameof(PagerSlim), Arguments.From(new { pager.Before, pager.After, @@ -40,7 +40,7 @@ public static ValueTask PagerSlimAsync(this IShapeFactory _shapeFactory, public static async ValueTask PagerSlimAsync(this IShapeFactory _shapeFactory, PagerSlim pager, IDictionary values) { - dynamic shape = await _shapeFactory.CreateAsync("PagerSlim", Arguments.From(new + var shape = await _shapeFactory.CreateAsync(nameof(PagerSlim), Arguments.From(new { pager.Before, pager.After, @@ -49,7 +49,7 @@ public static async ValueTask PagerSlimAsync(this IShapeFactory _shapeFa if (values != null && values.Count > 0) { - shape.UrlParams(values); + shape.Properties["UrlParams"] = values; } return shape;