Disabling automatic pluralization in Linq to SQL Classes for a single class only
I have a single table name with an irregular plural 开发者_运维技巧(the plural is the same as the singular). Is there any way to disable the automatic pluralization (Account = DB.Accounts) for that single table while retaining the feature for the others?
You need to disable the Pluralize Table Names for the LINQ to SQL designer.
To do this navigate to Tools -> Options -> Database Tools -> O/R Designer and change the Pluralization of names to false.
Then you will need to recompile your project and it should address the naming
Linq to SQL: How do I stop the auto generated object name from being renamed?
If you're really only worried about a single class, I would let the Framework pluralize the name and then simply manually remove the pluralization for the one class you're worried about.
I think you can´t do this using pure Linq2SQL.
On Entity Frameowrk + T4 template for generate Linq 2 SQL entities you can customize a T4 template for take control of pluralization, implementing your own rules exceptions.
精彩评论