LINQ to SQL Converter
- by user609511
How can I convert My LINQ to SQL ?
i have this LINQ statement:
int LimCol = Convert.ToInt32(LimitColis);
result = oListTUP
.GroupBy(x => new { x.Item1, x.Item2, x.Item3, x.Item4, x.Item5 })
.Select(g => new
{
Key = g.Key,
Sum = g.Sum(x => x.Item6),
Poids = g.Sum(x => x.Item7),
})
.Select(p => new
{
Key = p.Key,
Items = Enumerable.Repeat(LimCol, p.Sum / LimCol).Concat(Enumerable.Repeat(p.Sum % LimCol, p.Sum % LimCol > 0 ? 1 : 0)),
CalculPoids = p.Poids / Enumerable.Repeat(LimCol, p.Sum / LimCol).Concat(Enumerable.Repeat(p.Sum % LimCol, p.Sum % LimCol > 0 ? 1 : 0)).Count()
})
.SelectMany(p => p.Items.Select(i => Tuple.Create(p.Key.Item1, p.Key.Item2, p.Key.Item3, p.Key.Item4, p.Key.Item5, i, p.CalculPoids)))
.ToList();
}
It works well, but somehow want to push it and it become too complicated, so I want to convert it into Pure SQL.
I have tried SQL Profiler and LinqPad, but neither shows me the SQL.
How can I see the SQL code from My LINQ ?
Thank you in advance.