Ok so I have two objects that look like this in my WCF service. When my MyProfile property in my User class comes back to the client all of its properties are null; however, nothing else is.
[DataContract]
[Serializable]
public class User {
private WebProfile.UserTable _MyProfile;
public WebProfile.UserTable MyProfile {
get { return _MyProfile; }
set { _MyProfile = value; }
}
}
[DataContract]
[Serializable]
public class WebProfile {
[DataContract]
[Serializable]
public class UserTable {
}
}
On the WCF service it looks like this.
#region User Contract...
[ServiceContract]
public interface IUser {
List<User> GetAllUsers();
}
#endregion
public List<User> GetAllUsers() {
return _users;
}
I have only listed the property in question because I believe its specific to that property being in a subclass.
Here is what I have done. I have verified that the data is actually being obtained from the database on the service end from the database. Also, that MyProfile has values for its properties via Event Log.
When the client requests a list of Users I write to the event log on the server hosting the service to make sure MyProfile’s properties have values. So the issue is either when the client deserializes the information or when the server serializes it to send to the client. Is it possible that my WebProfile class needs to be decorated with some type of attribute?
Again, I have verified that the User is coming back with values for all of its extra properties and that before the object leaves the server that the values are populated.
Any suggestions?
None of the class’s properties for said object were decorated with the [DataMember] attribute.