We’ve been working with DbLinq for a while now, at HexaSystems and recently using it together with Dynamic Linq and SQLite I programed a call to the Count method of a Queryable object as follows:
1public static int Count(this IQueryable source)
2{
3 if (source == null) throw new ArgumentNullException("source");
4
5 return (int)source.Provider.Execute(
6 Expression.Call(
7 typeof(Queryable),
8 "Count",
9 new Type[] { source.ElementType },
10 source.Expression));
11}
I noticed that when doing so against a DbLInq Table object the following method is called:
1public object Execute(Expression expression)
2{
3 ....
4}
The problem is that the function calls the generic Execute method inside the same class with the generic argument of type object: “Execute(expression)” which causes an invalid cast exception in the case I’m talking about, and potentially any call to this method could fail when the expression evaluation creates a generic type. I’ve submitted a patch to DBLinq developers and it was offically accepted: http://code.google.com/p/dblinq2007/source/detail?r=1224
Comments