I just finished using Linq to Sql to map our existing Database structure for use in a Thick Client app.
While writing some Linq Methods to replace some Stored Procedures I noticed that sometimes I could do tblOne.tblTwo.MyDesiredField
. I learned that there needed to be an association
in the dbml for that to work. Well mine was missing some obvious ones so I added a bunch.
That was when I noticed that sometimes I couldn't do the above as some of the associated tables are considered EntitySets<tblThree>
instead of the table, tblThree
itself?
To me, there seems to be no rhyme or reason as to what I'll get. Am I doing something wrong in the dbml
? Something I need to change in the Properties
?
Is this cause for concern? I noticed that to use an EntitySet<tblThree>
I need to add an extra from
..
from person in context.tblPersons
from address in person.tblAddress where address.AddressType == "Home"
select new {person.Name, address.Home};