I started a project that will allow me to create sql queries using lambda expressions.
for some reason when I'm trying the following code, the lambda injected with "Convert" method please help me understand the reason and how I can avoid it.
GroupBy function:
public QueryBuilder<T> GroupBy(params Expression<Func<T, object>>[] expression)
{
_groupBy.AddRange(expression);
return this;
}
Usage example:
query.GroupBy(x=>x.IntExample,x=>x.StringExample)
from the immediate:
expression
{System.Linq.Expressions.Expression<System.Func<Tests.Example,object>>[2]}
[0]: {x => Convert(x.IntExample)}
[1]: {x => x.StringExample}
Fill free to fork the project: https://github.com/matanshidlov/Lambda-To-Sql/tree/master/Lambda-To-Sql