I am newbie to WCF. Hence, this question. I am in the process of converting an asmx web service to WCF service.
I am having trouble defining data contracts.
I have two operations on my service contract, one returns an array of Customer
, where Customer
is my custom type with some fields.
Here, my question is which needs to declared as data contract.
Is it the Customer
class or Customers
class which contains an array of Customer
or is it both?
Please do suggest
You should read this MSDN article on DataContracts: Using Data Contracts.
In short:
You should define the DataContract
attribute on every class you use in your service that goes across the line, so you would need the attribute on both Customer
and Customers
.