You are designing a Windows Communication Foundation (WCF) service that uses the Product class.
You need to update the class to meet the storage requirement.
What should you do? (Each correct answer presents part of the solution. Choose all that apply.)
A . Mark the Product class with the DataContract attribute.
B . Mark the public members of the Product class with the DataContractFormat attribute.
C . Mark the Product class with the CollectionDataContract attribute.
D . Mark the public members of the Product class with the DataMember attribute.
Answer: A, D
Explanation:
So as of .NET 3.5 SP1, you don’t have to add data contract or data member attributes anymore – if you don’t then the data contract serializer will serialize all public properties on your class, just like the XML serializer would.
HOWEVER: by not adding those attributes, you lose a lot of useful capabilities:
• without [DataContract], you cannot define an XML namespace for your data to live in
• without [DataMember], you cannot serialize non-public properties or fields
• without [DataMember], you cannot define an order of serialization (Order=) and the DCS will serialize all properties alphabetically
• without [DataMember], you cannot define a different name for your property (Name=)
• without [DataMember], you cannot define things like IsRequired= or other useful attributes
• without [DataMember], you cannot leave out certain public properties – all public properties will be serialized by the DCS
Latest 70-486 Dumps Valid Version with 255 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund