Linq To SQl Reference Keys behavior?
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 Custome开发者_JAVA百科r 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.
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.
精彩评论