Which code segment should you use in this class?

A Windows Communication Foundation (WCF) service handles online order processing for
your company. You discover that many requests are being made with invalid account
numbers. You create a class named AccountNumberValidator that has a method named
Validate. Before the message is processed, you need to validate account numbers with
AccountNumberValidator and reject messages with invalid account numbers. You create a
new class that implements the IParameterInspector interface. Which code segment should
you use in this class?

A Windows Communication Foundation (WCF) service handles online order processing for
your company. You discover that many requests are being made with invalid account
numbers. You create a class named AccountNumberValidator that has a method named
Validate. Before the message is processed, you need to validate account numbers with
AccountNumberValidator and reject messages with invalid account numbers. You create a
new class that implements the IParameterInspector interface. Which code segment should
you use in this class?

A.
public void AfterCall(string operationName, object[] outputs, object returnValue, object
correlationState) { return; } public object BeforeCall(string operationName, object[] inputs) {

string accountNumber = GetAccountNumber(inputs); var validator = new
AccountNumberValidator(); if (!validator.Validate(accountNumber)) { return new
FaultException(); }}

B.
public void AfterCall(string operationName, object[] outputs, object returnValue, object
correlationState) { string accountNumber = GetAccountNumber(outputs); var validator =
new AccountNumberValidator(); if(!validator.Validate(accountNumber) }{ returnValue = new
FaultException(); }} public object BeforeCall(string operationName, object[] inputs) { return
null; }

C.
public void AfterCall(string operationName, object[] outputs, object returnValue, object
correlationState) { string accountNumber = GetAccountNumber(outputs); var validator =
new AccountNumberValidator(); if(!validator.Validate(accountNumber)) { throw new
FaultException(); }} public object BeforeCall(string operationName, object[] inputs) { return
null; }

D.
public void AfterCall(string operationName, object[] outputs, object returnValue, object
correlationState) { return; } public object BeforeCall(string operationName, object[] inputs) {
string accountNumber = GetAccountNumber(inputs); var validator = new
AccountNumberValidator(); if (!validator.Validate(accountNumber)) { throw new
FaultException(); } return null;}



Leave a Reply 0

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