views:

132

answers:

0

I'm using the T4 toolbox 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?