PrepAway - Latest Free Exam Questions & Answers

What should you do?

You are developing a Windows Communication Foundation (WCF) service that contains the following service contract.

[ServiceContract()]
public interface IPaymentService
{
[OperationContract()]
void RecordPayments(Person person);
}

public class Person
{ … }
public class Employee : Person
{ … }
public class Customer : Person
{ … }

You need to ensure that RecordPayments can correctly deserialize into an Employee or a Customer object.
What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Add the following KnownType attribute to the Employee class and to the Customer class.
[KnownType(GetType(Person))]

B.
Implement the IExtensibleDataObject interface in the Person class.

C.
Implement the IExtension(ofType(T)) interface in the Person class.

D.
Add the following KnownType attributes to the Person class.
[KnownType(GetType(Employee))]
[KnownType(GetType(Customer))]

Explanation:
Data Contract Known Types
(http://msdn.microsoft.com/en-us/library/ms730167.aspx)

The KnownTypeAttribute class allows you to specify, in advance, the types that should be included for consideration during deserialization.

One Comment on “What should you do?


Leave a Reply