views:

59

answers:

3

I have just started using Linq2sql, it generates all of the Classes after my tables which is awesome. my problem is that i have a lot of objects that have the same name as my tables.

this is forcing my to fully namespace everything which i don’t really like as i think it makes my code look messy.

Has anyone found an elegant way to get around this?

ps: i know about namespace aliases and im not really a fan.

A: 
Robert MacLean
This doesn't really answer the problem of the table name and the name of an item elsewhere in his application being the same, but thanks for pointing that option out - I'd missed it.
Pete OHanlon
A: 

Along the lines of Rails convention (which I use in my .net) frequently I will name the database table the plural name and the class the single name eg. Table = Users vs. Class = User.

Michael Gattuso
+2  A: 

If this really is an issue for you, you can change the name of your generated table items in the Linq designer. Select the table and change the value in the Name field in the properties (L2S keeps track of the source table as a separate item, so the two don't have to be named the same). Note that regenerating your DBML file will wipe these changes out.

Pete OHanlon
thanks, exactly what i was after
aaron