Possible Duplicate:
Adding methods to DataContract objects for WCF
is possible to expose method in data contract class?
ex:
[Datacontract]
Public Class Customer
{
[Datamember]
Public string ID
{
get;set;
}
Public void AddSession(string key, int len)
{
}
}
how to expose "AddSession" method at client when client consume this service?
Exposing Methods in a Datacontracts
will not make sense.DataContracts can be applied only to the state of your objects or in otherwords member fields of the class.Methods are not states but rather they are agents of state change.
And you should not have a OperationContract inside the DataContract here is why
Can a WCF data contract contain a WCF operation contract inside it? Why?