Microsoft Exam Questions

What should you do?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
You use Plain Old CLR objects (POCO) to model your entities.
The application communicates with a Windows Communication Foundation (WCF) Data Services service.
You need to ensure that entities can be sent to the service as XML. What should you do?

A.
Apply the virtual keyword to the entity properties.

B.
Apply the [Serializable] attribute to the entities.

C.
Apply the [DataContract(IsReference = true)] attribute to the entities.

D.
Apply the [DataContract(IsReference = false)] attribute to the entities.

Explanation:
DataContractAttribute Specifies that the type defines or implements a data contract and is serializable by a serializer,
such as the DataContractSerializer. To make their type serializable, type authors must define a data contract for their type.
IsReference Gets or sets a value that indicates whether to preserve object reference data.