views:

42

answers:

1

Hi all,

Here is the scene.

Agents -> Organization -> Schools Agents -> Persons -> Educators

So each of the 5 tables exist in the data base. The AgentId (GUID -> uniqueidentifier) is generated in the Agents table and I need it to be passed on to Organization -> Schools or Persons -> Educators. But Linq to SQL does not reconize that, and I did not expect it to. But I don't know whats is the best way of doing this. Right now I get a Empty (00000-0000-000000-00000) identifier in the Persons or Organizations table.

Any takes on this?

Thanks.

A: 

Are you saying that when you add an organization entity to the agents entity, you want the organizations AgentID to be populated with the parent agent entity's agentID? Did you define the key in the database and does that key show in the LINQ to SQL designer? If you remove the reference in the designer (as I frequently do to get around the lack of MANY to MANY support) then you will need to add the key manually to the Organization (and all other) entity prior to adding it to the Agent. Then when you save it it should have the appropriate key.

Andrew Siemer
My diagram has AgentId in all objects, the one in the Agent object I set it to Auto Generated Value in the Designer. The relationship in this case is actually 1 to 1 so oneAgent.Person instead of oneAgent.Persons.
Oakcool