protected virtual LambdaExpression CreateLambaExpression(Type tSource) { Debug.Assert(tSource != null); Debug.Assert(!string.IsNullOrEmpty(Id.LookupId)); return(ExpressionFactory.CreateFieldSelectorLambda(tSource, Id.LookupId)); }
protected virtual MethodCallExpression GetPropertyOrFieldAggregateExpression(Type tSource, Expression param) { // otherwise the target of the aggregate is a property on the source type such as Avg(Age) Expression lambda = ExpressionFactory.CreateFieldSelectorLambda(tSource, SourceFieldName); return(Expression.Call(EvaluatatorType, Name, new Type[] { tSource }, param, lambda)); }
private static Expression CreateKeySelector <T>(string name, Type keyType, ParameterExpression param) { // special case for when the key is the data item, not a field of the data item if (name.Equals("this", StringComparison.OrdinalIgnoreCase) || name.Equals("that", StringComparison.OrdinalIgnoreCase)) { return(ExpressionFactory.CreateIdentitySelector <T, T>()); } return(ExpressionFactory.CreateFieldSelectorLambda(param, name, keyType)); }
protected override MethodCallExpression GetPropertyOrFieldAggregateExpression(Type tSource, Expression param) { LambdaExpression lambda = ExpressionFactory.CreateFieldSelectorLambda(tSource, SourceFieldName); return(Expression.Call(EvaluatatorType, Name, new Type[] { tSource, tSource.GetFieldType(SourceFieldName) }, param, lambda)); }