I am a newbie in WCF, currently I am developing a TCP WCF service and I am not sure that I understand passing parameters correctly or not so I recommend you to comment and give a standardized way.
To get things clear I developed a small service for testing purpose that has single method and depends on an external .Net dll that exposes single class. The service contract code
[ServiceContract]
public interface IMyService
{
[OperationContract]
int Test1(actionType at, calculationType ct, action a);
[OperationContract]
int Test2(DataSeries s);
}
Where actionType
,calculationType
,action
are enums declared inside the the external dll
and DataSeries
is a class declared inside the dll.
The origianl defination for the DataSeries
class in the dll is marked by [Serializable]
only and no [DataMember]
on its members.
I am using the 3rd dll on the client and server side, my surprise was both applications working fine without putting [DataContract]
on the DataSeries class and without using any of [EnumMember]
inside enums, [DataMember]
inside class.
So what is going on?
Another Experiment:
Removing the 3rd party from the client side and using the service as it is
I found that the vs2008 generates the enums and the DataSeries
class and markes them with the proper attributes?
like
[System.CodeDom.Compiler.GeneratedCodeAttribute ("System.Runtime.Serialization", "3.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="actionType", Namespace="http://schemas.datacontract.org/2004/07/DBInterface")]
public enum actionType : int {
[System.Runtime.Serialization.EnumMemberAttribute()]
All = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
Buy = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
Sell = 2,
}