could some one please confirm whether I should always have a DataContract and datamember attribute for Operation Parameter and return types?
e.g.
ResponseMessage getOrderDetails(RequestMessage msg)
{
....
}
public class ResponseMessage
{
...
}
public class RequestMessage
{
...
}
The parameter types and return types need to be either serializable or treated in a special way by WCF.
For the first case,
[DataContract]and[DataMember]is only one way to make a type serializable – the post at http://blogs.msdn.com/b/sowmy/archive/2006/02/22/536747.aspx describes the serialization programming model in WCF. As Ladislav mentioned, starting with .NET 3.5 SP1 WCF introduced a default (POCO) serialization so you don’t need any annotation at all.For the second case, there are some types which are treated as special cases by WCF, such as
System.IO.StreamorSystem.ServiceModel.Channels.Message– and you can even add more such types if you use a custom message formatter (although this is an advanced scenario and not very common).