I have some object classes that use inheritance. It seems that I can only get access to the objects that are directly used by a service. Let me show you what I am trying to accomplish:
[DataContract]
public class Object1
{
[DataMember]
int Id {get; set;}
}
[DataContract]
public class object2: Object1
{
[DataMember]
string Name {get; set;}
}
[DataContract]
public class object3
{
[DataMember]
int SomeNumber {get; set;}
}
The Service:
public int GetId(object2 obj)
{
return GetTheId(object2.Name);
}
Now since I am using object2 in the service, object1 gets serialized too. Howerver, I may want to have object3 exposed for some reason. It may be a derived class that I have to pass so that its type can be determined later for another process. I do not see this object getting serialized. I assumed that whenever you set the DataContract / DataMember those objects would get serialized. It does make sense not to expose something that is not begin used, becuase I can see an issue with exposing items you may not need. What is the best way to expose objects that are not directly used by a service? Thanks
Daniel