Converting expression trees to sql
Posted: Thu 21 Jul 2011 09:11
I'm migrating my application from MySQL .NET Connectro to MySQL DotConnector. One of the motivations was that .NET Connector generates very inefficient queries. I hoped your products are much better at this as you have a lot of experience in this field. But looks like DotConnector is also not ideal.
For example, for this expression:
Is there any documentation or advices of which constructs are better to use? I will post some more examples in this post later.
For example, for this expression:
there will be generated two joins. But if I replace it toctx.EnumParameterValues.Where(epv => epv.Parameter.IsAutogenerated == 0 && epv.Parameter.IsDeleted == 0);
I get the query with one Join as expected.ctx.EnumParameterValues.Where(epv => epv.ItemId == itemId).Join(ctx.Parameters, epv => epv.ParameterId, p => p.Id, (epv, p) => new { epv, Parameter = p }).Where(at => at.Parameter.IsAutogenerated == 0 && at.Parameter.IsDeleted == 0)
Is there any documentation or advices of which constructs are better to use? I will post some more examples in this post later.