This is a migrated thread and some comments may be shown as answers.

Telerik.Web.Mvc.Extensions.QueryableExtensions.Count implementation causes trouble for our LINQ provider

1 Answer 90 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Barnabas
Top achievements
Rank 1
Barnabas asked on 04 Oct 2010, 04:12 PM
Hello,

We have Sybase ASE as our backend database and we have struggled to find a good LINQ provider. We finally arrived at http://bltoolkit.net/ which has been a fantastic solution for us. The trouble is that the implementation of the Count function in the Telerik QueryableExtensions uses System.Linq.IQueryProvider.Execute and casts the result to int. The bltoolkit that we are using does not currently have full support for that method. It does however have full support for System.Linq.IQueryProvider.Execute<TResult>. I believe the Telerik method would work better if they called an execute that is strongly typed, instead of asking for an object and then casting it back to an int.

public static int Count(this IQueryable source)
{
    if (source == null)
    {
        throw new ArgumentNullException("source");
    }
    return (int) source.Provider.Execute(Expression.Call(typeof(Queryable), "Count", new Type[] { source.ElementType }, new Expression[] { source.Expression }));
}


would become
public static int Count(this IQueryable source)
{
    if (source == null)
    {
        throw new ArgumentNullException("source");
    }
    return source.Provider.Execute<int>(Expression.Call(typeof(Queryable), "Count", new Type[] { source.ElementType }, new Expression[] { source.Expression }));
}


Thanks so much for your time and consideration.

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 05 Oct 2010, 09:32 AM
Hi Barnabas,

Thank you for your suggestion. Indeed, we will apply the proposed modification to our source code.  The updated version will be incorporated in the next internal build. I have updated your telerik points as a token of gratitude.

Best regards,
Rosen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Barnabas
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or