It may be something that I'm doing wrong and I'm still investigating, but just incase it's something simple I thought I'd send a quick mail - I've got several tests that are throwing ArgumentExceptions from StreamedSingleValueInfo.ExecuteQueryModel, at the point that it tries to create the delegate into the generic method. An example of a query that's failing is:
decimal? q = db.Products.Select(p => p.UnitPrice).Min();
I'll carry on looking here, but if there's any light you can shed on it, that would be great.
Update on the ArgumentException that I was getting. Looks like a bug in StreamedSingleValueInfo.cs - currently, the generic method is defined as:
public T ExecuteSingleQueryModel<T> (QueryModel queryModel, IQueryExecutor executor)
{
....
}
with the delegate creation being:
var func = (Func<QueryModel, IQueryExecutor, object>) Delegate.CreateDelegate (typeof (Func<QueryModel, IQueryExecutor, object>), this, executeMethod);
I think the method needs to be changed to:
public object ExecuteSingleQueryModel<T> (QueryModel queryModel, IQueryExecutor executor)
{
....
}
I've done this locally, and it's working better now. Not sure quite why it's taken me so long to spot the mismatch in the prototypes; I blame the painkillers that I'm on at the moment
Bonus: update ToString() such that it writes
{ [x] }instead of
{ from <generated> in [x] select <generated }and
{ ([x]).Count() }instead of
{ (from <generated> in [x] select <generated).Count() }(assuming ResultOperator syntax from COMMONS-1585)
Change CountExpressionNode to support the get_Count methods as well as Enumerable/Queryable's Count methods
Idea: In ExpressionTreeParser, recognize MemberExpressions that refer to properties. Build an equivalent MethodCallExpression using the getter method, then apply the MethodCallExpressionParser. If this does not succeed, parse the MemberExpression as usual.
Also adjust SubQueryFindingVisitor accordingly.