SQL 到 LINQ 工具

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/296972/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 00:17:05  来源:igfitidea点击:

SQL to LINQ Tool

sqllinq

提问by Chris

Is there a tool out there which can convert SQL syntax to LINQ syntax?

是否有可以将 SQL 语法转换为 LINQ 语法的工具?

I just want to rewrite basic queries with join, etc., to LINQ. It would save me a lot of time.

我只想用 join 等将基本查询重写为LINQ。这会为我节省很多时间。

采纳答案by Nikki9696

Linqeris a SQL to LINQ converter tool. It helps you to learn LINQ and convert your existing SQL statements.

Linqer是一个 SQL 到 LINQ 的转换器工具。它可以帮助您学习 LINQ 并转换您现有的 SQL 语句。

Not every SQL statement can be converted to LINQ, but Linqer covers many different types of SQL expressions. Linqer supports both .NET languages - C# and Visual Basic.

不是每个 SQL 语句都可以转换为 LINQ,但 Linqer 涵盖了许多不同类型的 SQL 表达式。Linqer 支持 .NET 语言 - C# 和 Visual Basic。

回答by wcm

I know that this isn't what you asked for but LINQPadis a really great tool to teach yourself LINQ(and it's free :o).

我知道这不是你想要的,但LINQPad是一个非常好的自学LINQ 的工具(而且它是免费的:o)。

When time isn't critical, I have been using it for the last week or so instead or a query window in SQL Serverand my LINQ skills are getting better and better.

当时间不是很关键时,我过去一周左右一直在使用它,或者SQL Server 中的查询窗口,我的 LINQ 技能越来越好。

It's also a nice little code snippet tool. Its only downside is that the free version doesn't have IntelliSense.

它也是一个不错的小代码片段工具。它唯一的缺点是免费版本没有IntelliSense

回答by chown

Bill Horst's - Converting SQL to LINQis a very good resource for this task (as well as LINQPad).

Bill Horst 的 - 将 SQL 转换为 LINQ是完成此任务(以及LINQPad)的非常好的资源。

LINQ Toolshas a decent list of tools as well but I do not believe there is anything else out there that can do what Linqer did.

LINQ Tools也有一个不错的工具列表,但我不相信还有其他任何东西可以做 Linqer 所做的事情。



Generally speaking, LINQ is a higher-level querying language than SQL which can cause translation loss when trying to convert SQL to LINQ. For one, LINQ emits shaped results and SQL flat result sets. The issue here is that an automatic translation from SQL to LINQ will often have to perform more transliterationthan translation - generating examples of how NOT to write LINQ queries. For this reason, there are few (if any) tools that will be able to reliably convert SQL to LINQ. Analogous to learning C# 4 by first converting VB6 to C# 4 and then studying the resulting conversion.

一般来说,LINQ 是一种比 SQL 更高级别的查询语言,在尝试将 SQL 转换为 LINQ 时可能会导致翻译丢失。一方面,LINQ 发出成形结果和 SQL 平面结果集。这里的问题是从 SQL 到 LINQ 的自动转换通常需要执行比翻译更多的音译- 生成如何不编写 LINQ 查询的示例。出于这个原因,很少有(如果有的话)工具能够可靠地将 SQL 转换为 LINQ。类似于通过首先将 VB6 转换为 C# 4,然后研究生成的转换来学习 C# 4。