29 lines
799 B
C#
29 lines
799 B
C#
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;
|
||
}
|
||
}
|
||
}
|