LinqPad adds an S to the end of every table

旧时模样 提交于 2019-12-05 03:27:51

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).

This is also the standard behaviour of LINQ2SQL generated artifacts - the IEnumerables on the DataContext are [TableName]s and the Entity is [TableName]. So your linq queries would typically be something like.

List<Category> categoryList = context.Categories.Where(cat => somePredicateOnCat).ToList();

This usually makes for intuitive reading. Would you consider dropping the Hungarian 'tbl' suffix off your table naming standards?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!