Association null after WCF call

Jan 7, 2010 at 12:39 AM
Edited Jan 7, 2010 at 12:40 AM

I'm using the Linq to SQL generator, and after making a WCF call, the association properties on my object are null and throwing a null reference exception in their setters. This is one such property:

 

[DataMember(Order = 4, EmitDefaultValue = false)]
[Association(Name = "Family_FamilyConfiguration", Storage = "familyConfigurations", ThisKey = "FamilyID", OtherKey = "FamilyID")]
public EntitySet<FamilyConfiguration> FamilyConfigurations
{
      get 
      {
           if (this.serializing && !this.familyConfigurations.HasLoadedOrAssignedValues)
           {
               return null;
           }
        
           return this.familyConfigurations; 
      }
        
      set 
      { 
          this.familyConfigurations.Assign(value); // EXCEPTION: familyConfigurations is null
      }
}

 

Prior to the call, the object is fully formed and correct, familyConfigurations included. I even ran it through a DataContractSerializer and confirmed that the object is properly serialized with the correct data, so I don't believe this is a serialization error, unless I'm missing something. I put a breakpoint in the class's constructor, on the line that initializes familyConfigurations, but it wasn't hit for some reason. All I've done is run the Linq to SQL generator (as is, not modified) against my tables, setting serialization to unidirectional. Have I done something wrong?

Jan 15, 2010 at 9:49 PM

Bump.

Coordinator
Jan 25, 2010 at 12:32 PM

Does the problem exist with code generated by the LINQ to SQL generator built into Visual Studio?

Jan 25, 2010 at 12:38 PM

No.

Coordinator
Jan 26, 2010 at 11:21 AM

Ok. Any idea what the difference is between code generated by MSLinqToSqlGenerator and T4 Toolbox?

Jan 26, 2010 at 1:10 PM

Nope. I compared the two, and they looked pretty similar. I went with another code generator, so I'm afraid I no longer have the code to compare it further.