Hi there,
thanks for the reply, but the example doesn't work in my senario:
to Recap:
I need to populate an intermediate entity.
I have a UniversityLocation Entity (all FKs populated)
I have a ZipCode Entity (no FKs)
and I need to populate the intermediate entity
UniversityLocationZipCode, which has it's own PK, and the FKs from UniversityLocation and ZipCode.
(please see the attched schema screenshot)
I tried the following code:
UniversityLocationZipCodeEntity univLocZipCodeEnt = new UniversityLocationZipCodeEntity();
univLocZipCodeEnt.UniversityLocation = UniversityLocation;
univLocZipCodeEnt.ZipCode = zipCode;
univLocZipCodeEnt.Save(true);
the error that this code produced says I cannot create the intermediate entity: UniversityLocationZipCodeEntity because it can't find the universitylocationid in the UniversityLocationEntity... but my UniversityLocationEntity does indeed have a universitylocationID....
Must I instead use code like the following and explicitly supply the FKs?
UniversityLocationZipCodeEntity univLocZipCodeEnt = new UniversityLocationZipCodeEntity();
univLocZipCodeEnt.Universitylocationid = UniversityLocation.Universitylocationid;
univLocZipCodeEnt.Zipcodeid = zipCode.Zipcodeid;
univLocZipCodeEnt.Save(true);
thanks,
Dustin