Chapter 11: Deploying Web Services with WCF

309

public CompositeType GetDataUsingDataContract( CompositeType composite)

{

if (composite == null)

{

throw new ArgumentNullException("composite");

}

if (composite.BoolValue)

{

composite.StringValue += "Suffix";

}

return composite;

}

}

}

VB:

'NOTE: You can use the "Rename" command on the

'context menu to change the class name "Service1"

'in both code and config file together.

Public Class Service1

Implements ICustomerService

Public Function GetData(

ByVal value As Integer) As String Implements ICustomerService.GetData

Return String.Format("You entered: {0}", value) End Function

Public Function GetDataUsingDataContract(

ByVal composite As CompositeType) As CompositeType Implements ICustomerService.GetDataUsingDataContract If composite Is Nothing Then

Throw New ArgumentNullException("composite") End If

If composite.BoolValue Then composite.StringValue &= "Suffix"

End If

Return composite End Function

End Class

Page 332
Image 332
Microsoft 9GD00001 manual 309