LinqPad在每个表的末尾添加一个S [英] LinqPad adds an S to the end of every table

查看:92
本文介绍了LinqPad在每个表的末尾添加一个S的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚下载了LinqPad,以探索在正在处理的应用程序中使用Linq查询的好处,但是,当我在左侧列中查看数据库表时,LinqPad会在表中显示所有带有's'的表.最后,例如CategoryTbl变成CategoryTbls,但是当我在SQL Management Studio中查看数据库时,表名似乎正确.

尽管任何表的末尾都应该有S,即客户端保持不变.

执行Linq查询时,我必须针对CategoryTbls执行它,但是必须针对CategoryTbl执行SQL查询.

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

谢谢

解决方案

LINQPad常见问题解答<中的第一个问题:

LINQPad为什么要对表和子关联属性进行复数?我可以关闭它吗?

对子关联属性进行复数化(同时保持父关联为单数形式)是最自然的查询,这是Visual Studio在构建类型化DataContexts时的默认设置.

要关闭复数,请在添加数据库连接时取消选中复数"选项. (如果已经创建了连接,请右键单击它以编辑连接属性.)

I have just downloaded LinqPad to explore the benefits of using Linq queries in an application I am working on, however when I look at my database tables in the column on the left LinqPad displays all my tables with an 's' on the end, for instance CategoryTbl becomes CategoryTbls yet when I view my database in SQL management studio the table names appear correct.

Though any tables that should have an S on the end ie clients remain unchanged.

When I execute a Linq query I have to execute it against CategoryTbls but a SQL query has to be executed against CategoryTbl.

I was just wondering why this has happened, is it a bug or a feature? and if it is a feature why?

Thanks

解决方案

The first question from the 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆