0
如何将My LINQ转换为SQL?LINQ to SQL转换器
我有这个LINQ声明:
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();
}
它运作良好,但不知为何要推它,它变得太复杂了,所以我想将其转换成纯SQL。
我已经尝试过SQL Profiler和LinqPad,但都没有向我显示SQL。
如何从My LINQ中查看SQL代码?
预先感谢您。
SQL事件探查器不显示对SQL服务器执行的命令?这听起来不对。它显示了什么? – David
LinqPad肯定[显示SQL生成](http://tenhundfeld.org/media/sql_to_sql.png) – Magnus
你一直在说“我的LINQ” - 这是MySQL还是SQL Server? – Yuck