The following is a fix for an issue with slow queries in DbLinq when using MySql. The problem causes very slow MySQL queries when using LINQ to SQL with DbLinq, and displays a list of ArgumentExceptions, thrown before the query is executed. The query can take up to 8-10 seconds to execute.
Here is a work-around fix for the issue:
Download the latest SVN code for DbLinq at
Open the following file for editing in Visual Studio 2008 DBLinq\src\DbLinq\Data\Linq\Sugar\Implementation\ExpressionOptimizer.cs
On line 78, the problem manifests itself when attempting to evaluate the lambda expression. Change the function AnalyzeConstant() as follows:
protected virtual Expression AnalyzeConstant(Expression expression, BuilderContext builderContext)
- Re-compile the DbLinq project to get the new DbLinq.dll and reference it in your projects. The ArgumentExceptions should no longer appear and queries are executed instantly.