From 7cd755c356a3aa2faa971f8d6a92d4226e022e03 Mon Sep 17 00:00:00 2001 From: Argo-Tianyi Date: Sat, 11 Dec 2021 13:50:36 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20IQueryable=20?= =?UTF-8?q?=E6=89=A9=E5=B1=95=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/IQueryableExtensions.cs | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/BootstrapBlazor/Extensions/IQueryableExtensions.cs diff --git a/src/BootstrapBlazor/Extensions/IQueryableExtensions.cs b/src/BootstrapBlazor/Extensions/IQueryableExtensions.cs new file mode 100644 index 000000000..9438cfbd0 --- /dev/null +++ b/src/BootstrapBlazor/Extensions/IQueryableExtensions.cs @@ -0,0 +1,60 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Website: https://www.blazor.zone or https://argozhang.github.io/ + +using System; +using System.Linq; +using System.Linq.Expressions; + +namespace BootstrapBlazor.Components +{ + /// + /// IQueryable 扩展方法 + /// + public static class IQueryableExtensions + { + /// + /// 条件 + /// + /// + /// + /// + /// + /// + public static IQueryable Where(this IQueryable queryable, Expression> predicate, bool condition) => condition ? queryable.Where(predicate) : queryable; + + /// + /// 排序 + /// + /// + /// + /// + /// + /// + /// + public static IQueryable Sort(this IQueryable queryable, string sortName, SortOrder sortOrder, bool condition) => condition ? queryable.Sort(sortName, sortOrder) : queryable; + + /// + /// 分页 + /// + /// + /// + /// + /// + /// + public static IQueryable Page(this IQueryable queryable, int skipCount, int maxResultCount) => queryable.Skip(skipCount).Take(maxResultCount); + + /// + /// 总数 + /// + /// + /// + /// + /// + public static IQueryable Count(this IQueryable queryable, out int totalCount) + { + totalCount = queryable.Count(); + return queryable; + } + } +} -- Gitee From 553738e8694cdab43abef3cab00e4862483a7d60 Mon Sep 17 00:00:00 2001 From: Argo-Tianyi Date: Sat, 11 Dec 2021 14:07:22 +0800 Subject: [PATCH 2/2] chore: bump version to 6.1.1-beta02 --- src/BootstrapBlazor/BootstrapBlazor.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index b65b2ad8a..5712a7ddc 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 6.1.1-beta01 + 6.1.1-beta02 -- Gitee