It is my understanding that every type (other than some primitives like int and string) used in a WCF ServiceContract need to be declared with ServiceKnownType attribute. But, I have build a custom object and it is transmitted accross my WCF service with no problem -- even though I have not added a ServiceKnownType for it. Will someone please explain why this works?
[ServiceContract(CallbackContract = typeof(IMyServiceCallback))]
public interface IMyService
{
[OperationContract]
List<MyObject> LoadMyObjects();
}
[DataContract]
public class MyObject
{
[DataMember]
private int batchID;
[DataMember]
private int fileID;
[DataMember]
private string fileName;
[DataMember]
private DateTime importStartTime;
// ...
}