Question

I got an entity called Proveedor on my Data Context. A property called Proveedors is generated for the Data Context to represent a collection of Proveedor. I rename it to Proveedores which is the correct spelling in Spanish. But as soon as I do anything on the model (not related to the Proveedor Entity) and rebuild it renames it back to Proveedors again.

I don't want to turn off pluralization just want it to stop renaming my renames :)

Thanks

Was it helpful?

Solution

When you make a change to the data model dbml file, the Linq to SQL classes are generated completely from scratch. Any modifications you make to the class files will be overwritten.

Changing the pluralization rules would have to be done by changing the code generation, but I do not know if this is possible.


You can change the generated name by right-clicking the table in the dbml designer window and selecting properties. There is a field called 'name' with which you should be able to define a custom name.

Also: this is not directly relevant to this particular issue, but if you want to add modifications to the generated classes, they are defined as partial classes. So you could add methods to the classes by creating a separate partial class.

OTHER TIPS

Where are you renaming it? If you change the generated C# code, it will be overwritten just as you've seen.

You need to change it in the dbml file. Open that file. Select the property, and then open the property panel and change it there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top