###BeginCaseStudy###
Testlet 1
Background
You are developing an online shopping web application.
Business Requirements
A user is not required to provide an email address. If a user enters an email address, it must be verified to
be a valid email address.
Information about the first product on the product page must fade out over time to encourage the user to
continue browsing the catalog.
Administrators must be able to edit information about existing customers.
Administrators also must be able to specify a default product on the product page.
Technical Requirements
General:
The web store application is in a load-balanced web farm. The load balancer is not configured to use server
affinity.
The web store application isan ASP.NET MVC application written in Visual Studio.
Products:
The value of the product ID property must always be greater than 0.
The Products page for mobile devices must display to mobile users. The Products page for desktop devices
must display to desktop users.
Storage:
The data must be stored in a serialized XML data format.
Serialized objects must be schema-independent.
Exception handling:
Exceptions originating from IIS must display a page with support contact information.
Some page links expire, and users who access these links encounter 404 errors.
Exceptions must be logged by using the WriteLog method of the Utility class.
Browser and device support:
The application must support image format conversions from .bmp to .jpeg for mobile devices.
The application must support image format conversions from .bmp to .png for desktop devices.
Application Structure
###EndCaseStudy###
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.
Explanation:
As of .NET 3.5 SP1, you don’t haveto 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=) andthe 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
http://stackoverflow.com/questions/4836683/when-to-use-datacontract-and-datamember-attributes