LinqPad 在每个表的末尾添加一个 S

标签 linq linq-to-sql linqpad

我刚刚下载了 LinqPad 来探索在我正在开发的应用程序中使用 Linq 查询的好处,但是当我查看左侧列中的数据库表时,LinqPad 会显示我所有的表,最后带有一个“s”,例如实例 CategoryTbl 变为 CategoryTbls 但当我在 SQL management studio 中查看我的数据库时,表名显示正确。

尽管任何应该在最后有 S 的表,即客户端保持不变。

当我执行 Linq 查询时,我必须针对 CategoryTbl 执行它,但必须针对 CategoryTbl 执行 SQL 查询。

我只是想知道为什么会发生这种情况,这是错误还是功能?如果它是一个功能,为什么?

谢谢

最佳答案

第一个问题来自LINQPad FAQ :

Why does LINQPad pluralize table and child association properties? Can I switch this off?

Pluralizing child association properties (while keeping parent associations singular) makes for the most natural queries and is what Visual Studio does by default in building typed DataContexts.

To switch off pluralization, uncheck the "Pluralize" option when adding the database connection. (If the connection has already been created, right-click it to edit the connection properties).

关于LinqPad 在每个表的末尾添加一个 S,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7833133/

相关文章:

c# - 如何让linq将数据从一种形式转换为另一种形式

c# - Linq 按 2 列(创建和修改)排序,以较大者为准

javascript - 从不同级别的对象中按属性名称获取值

c# - LINQ to SQL 连接和求和

linq-to-sql - linq to sql 查询的迭代非常慢

.net - 绘制新的 System.Drawing.Bitmap

c# - 如何在选择查询中添加函数

sql - 我可以在 ASP.net MVC 中使用纯 SQL 吗?

sql-server-ce - LINQPad 请求自定义程序集

c# - linqpad 无法加载文件或程序集 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'