What does the LINQ EntitySet <table> Association do?
I just finished using Linq to Sql to map our existing database structure for use in a Fat Client application.
While writing some Linq methods to replace some of the stored procedures, I noticed that sometimes I could do tblOne.tblTwo.MyDesiredField
. I found out what the dbml must be in order to work. Mine was missing some of the obvious ones, so I added a bunch. association
Was that when I noticed that sometimes I couldn't do it as some of the related tables are counted EntitySets<tblThree>
instead of the table tblThree
myself?
For me, there doesn't seem to be any rhyme or reason for what I get. Am I doing something wrong in dbml
? Is there something I need to change in Properties
?
Is this a cause for concern? I noticed that 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};
a source to share
EntitySet is a result set. If tableA has a 1-to-many relationship with table B, then tableA.tableB refers to a collection of results in table B that reference the result in table A.
A table is just a table. If you drag and drop with the constructor, you will see that it expands the entity many times over, making things more readable.
EDIT: I am guessing from the sounds of your setup you will probably see the entitySet object like this
from b in TableA select b.TableB
in this case TableA is a table and b.TableB is an EntitySet
a source to share