Hi Mr Primary Objects :),
the patch seems good. Can you provide it as a .patch file, so I can commit
it to the repository?

Thanks.
Pascal.

jabber/gtalk: [email protected]
msn: [email protected]



On Wed, Jan 21, 2009 at 22:41, <[email protected]> wrote:

>
>
>  I've also come across this same problem with DbLinq and very slow
> MySQL queries. You'll see a list of ArgumentExceptions thrown before
> the query is executed and it can take up to 8-10 seconds to execute.
>
>  Here is a work-around fix for the issue:
>
> 1. Download the latest SVN code for DbLinq at
> http://code.google.com/p/dblinq2007/source/checkout
>
> 2. Open the following file for editing in Visual Studio 2008 DBLinq\src
> \DbLinq\Data\Linq\Sugar\Implementation\ExpressionOptimizer.cs
>
> 3. 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)
>        {
>            // we try to find a non-constant operand, and if we do, we
> won't change this expression
>            foreach (var operand in expression.GetOperands())
>            {
>                if (!(operand is ConstantExpression))
>                    return expression;
>            }
>            // now, we just simply return a constant with new value
> // ***** COMMENTED OUT CODE *****
>            /*try
>            {
>                var optimizedExpression = Expression.Constant
> (expression.Evaluate());
>                // sometimes, optimizing an expression changes its
> type, and we just can't allow this.
>                if (optimizedExpression.Type == expression.Type)
>                    return optimizedExpression;
>            }
>                // if we fail to evaluate the expression, then just
> return it
>            catch (ArgumentException) { }*/
> // ***** END COMMENTED OUT CODE *****//
>
>            return expression;
>        }
>
> 4. 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.
>
>  Hope that helps.
>
>  Primary Objects
>  http://www.primaryobjects.com
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DbLinq" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/dblinq?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to