LINQ到SQL转换器
如何将LINQ转换为SQL 我有以下LINQ声明:LINQ到SQL转换器,sql,linq,converter,Sql,Linq,Converter,如何将LINQ转换为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
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
如何从LINQ中查看SQL代码
提前感谢您。这里是MSDN的一个示例
请注意,在他们的示例中,变量db是DatabaseContext。SQL Profiler不显示针对SQL server执行的命令?听起来不对。它显示了什么?LinqPad您肯定一直在说“我的LINQ”-这是MySQL还是SQL Server?