我有一个自定义扩展方法,如下面的
public static IQueryable<TSource> AnyCollection<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
{
ICollection<EDMX.ApplicantEducation> abc = (ICollection<EDMX.ApplicantEducation>) source;
return source.GroupBy(keySelector).Select(x => x.FirstOrDefault());
}
是否可以将它包含在Expression类中,以便我可以像这样使用它
var temp=Expression.Call(predicate, typeof(Models.ApplicantEducationVM).GetMethods(BindingFlags.Static | BindingFlags.Public)
.AnyCollection(...);
有可能吗?怎么样?