Which code segment should you use?

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.
You find that the service starts even though the endpoints have not been configured correctly.
You need to create a custom service behavior that throws an exception if the list of endpoints that are configured is not complete.
Which code segment should you use?

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.
You find that the service starts even though the endpoints have not been configured correctly.
You need to create a custom service behavior that throws an exception if the list of endpoints that are configured is not complete.
Which code segment should you use?

A.
class CustomBehavior:IServiceBehavior
{
public void Validate(ServiceDescription description, ServiceHostBase serviceHostBase)
{
MyValidationMethod(); {//validates list of endpoints. }
}

B.
class CustomBehavior:IEndpointBehavior
{
public void Validate(ServiceEndpoint endpoint)
{
MyValidationMethod(); {//validates list of endpoints. }
}

C.
class CustomBehavior:IContractBehavior
{
public void Validate(ContractDescription contractDescription, ServiceEndpoint endpoint)
{
MyValidationMethod(); {//validates list of endpoints. }
}

D.
class CustomBehavior:IOperationBehavior
{
public void Validate(OperationDescription operationDescription)
{
MyValidationMethod(); {//validates list of endpoints. }
}

Explanation:
http://msdn.microsoft.com/en-us/library/system.servicemodel.description.iservicebehavior.aspx



Leave a Reply 0

Your email address will not be published. Required fields are marked *