EF拓展

1 条件判断是否要加过滤条件

public static IQueryable<T> WhereIf<T>(
this IQueryable<T> source,
Expression<Func<T, bool>> predicate,
bool condition)
{
source.CheckNotNull<IQueryable<T>>(nameof (source));
predicate.CheckNotNull<Expression<Func<T, bool>>>(nameof (predicate));
return condition ? source.Where<T>(predicate) : source;
}

2 swagger文档

https://www.cnblogs.com/dukang1991/p/5627673.html

https://note.youdao.com/ynoteshare1/index.html?id=87b3d19683d150102744d4c4cc2f4c98&type=note

猜你喜欢

转载自www.cnblogs.com/xiewenyu/p/10688708.html
EF
今日推荐