Zxd.Core/code/DG.Core/Extensions/LinqMethodExtensions.cs

29 lines
799 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DG.Core
{
public static class LinqMethodExtensions
{
/// <summary>
/// 使用自定linq扩展执行排序查询分页功能 item1: 未分页结果item2分页后的结果
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="source"></param>
/// <param name="coditionEntity"></param>
/// <returns></returns>
public static IQueryable<T> UseCoditionFind<T>(this IQueryable<T> source, bool condition, Action<IQueryable<T>> action)
{
if (condition)
{
action(source);
}
return source;
}
}
}