
Chapter 11: Deploying Web Services with WCF | 307 |
<OperationContract()>
Function InsertCustomer(ByVal cust As Customer) As Integer
<OperationContract()>
Sub UpdateCustomer(ByVal cust As Customer)
End Interface
You already know how to specify an interface, and the preceding section explained the purpose of ServiceContract and OperationContract attributes. Listing
There are times when you’ll need to return a custom type from a WCF service. For example, if you need to fill in a
Listing 11-3 A custom type for a WCF service contract
C#:
[DataContract]
public class CustomerLookup
{
[DataMember]
public int CustomerID { get; set; }
[DataMember]
public string CustomerName { get; set; }
}
VB:
<DataContract()>
Public Class CustomerLookup
<DataMember()>
Public Property CustomerID() As Integer
<DataMember()>
Public Property CustomerName() As String
End Class