Disabling automatic pluralization in Linq to SQL classes for only one class

I have one table name with an irregular plural (the plural is the same as the singular). Is there a way to disable automatic pluralization (Account = DB.Accounts) for this single table while keeping this function for others?

+7
source share
3 answers

You need to disable the Pluralize table names for the LINQ to SQL constructor.

To do this, go to Tools -> Options -> Database Tools -> O / R Designer and change the name plural to false.

Then you will need to recompile your project, and it should turn to naming

Linq to SQL: how to stop changing the name of a generated autogenerator?

+13
source

If only one class really bothers you, I would let Framework pluralize the name, and then just manually remove the pluralization for the single class you are worried about.

+1
source

I think you cannot do this using pure Linq2SQL.

In the Entity Frameowrk + T4 template to create Linq 2 SQL objects, you can configure the T4 template to control pluralization by implementing your own rule exceptions.

0
source

All Articles