views:

30

answers:

1

I have a database with some references,

An example is a Customer Table has the AddressId integer column, and an Address Table has the Idenity Auto Generated Id column. I reference these as primary the Address "Id" and the Customer "AddressId". Now when i generate the dbml file or use SqlMetal, i get in the Customer entity two properties for the reference, AddressId that is an int type, and Address as an Address type. This is confusing! can i get rid of this functionality?

And how could i turn off pluralize? Thank you.

+1  A: 

You cannot turn off the 'feature' of generating both the foreign entity reference and the foreign key reference. L2S uses both of them in conjunction. So, you're going to have to get used to it. It was a little hard for me to get used to at first, but I then realized there are benefits to having both.

If I recall, SQLMetal has a command line option to turn off pluralizing, but cannot say for sure. I wrote my own code generator that generates my entities and data context object and I have it generate non-plural names.

Randy Minder
Why wrote your own generator?
@gtas - I wrote my own generator for a couple reasons. The first is that changing the DBML for every schema change became a big hassle. The second is that we wanted two sets of entities. We wanted a 'light-weight' set that didn't have all the L2S plumbing which we could serialize for Remoting. These are for client-side use. And we wanted L2S entities with modifications. And there were other reasons as well.
Randy Minder
Is this tool you wrote shared for other, like me? I could use this to create a light domain model for sharing with other layers. I would be grateful. Thank you!
I'm afraid not. I wrote it for our development team at work.
Randy Minder