private static LambdaExpression BindFilterClause(FilterBinder binder, FilterClause filterClause, Type filterType) { LambdaExpression filter = binder.BindExpression(filterClause.Expression, filterClause.RangeVariable, filterType); filter = Expression.Lambda(binder.ApplyNullPropagationForFilterBody(filter.Body), filter.Parameters); Type expectedFilterType = typeof(Func <,>).MakeGenericType(filterType, typeof(bool)); if (filter.Type != expectedFilterType) { throw Error.Argument("filterType", SRResources.CannotCastFilter, filter.Type.FullName, expectedFilterType.FullName); } return(filter); }
private static LambdaExpression BindOrderByClause(FilterBinder binder, OrderByClause orderBy, Type elementType) { LambdaExpression orderByLambda = binder.BindExpression(orderBy.Expression, orderBy.RangeVariable, elementType); return(orderByLambda); }