/// <summary> /// Extendable method: 数据源中是否任何一个元素都满足条件 /// </summary> /// <typeparam name="TEntity">实体类型</typeparam> /// <param name="source">数据源</param> /// <param name="predicate">条件表达式</param> /// <returns>数据源中是否任何一个元素都满足条件</returns> private static bool Any <TEntity>(this IDbQuery <TEntity> source, Expression <Func <TEntity, bool> > predicate) where TEntity : class { return(source.Count(predicate) > 0); }