70-516 · Question #13
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a Windows Communication Foundation (WCF) Data Services service. You need to update the City property of the Customer…
The correct answer is C. MERGE /Northwind.svc/Customers(123). OData supports the following HTTP actions to perform create, read, update, and delete operations on the entity data that the addressed resource represents: HTTP GET-This is the default action when a resource is accessed from a browser. No payload is supplied in the request…
Question
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a Windows Communication Foundation (WCF) Data Services service. You need to update the City property of the Customer record that has its ID value as 123. You also need to preserve the current values of the remaining properties. Which HTTP request should you use?
Exhibit
Options
- APUT /Northwind.svc/Customers(123)
- BPUT /Northwind.svc/Customers(123)
- CMERGE /Northwind.svc/Customers(123)
- DMERGE /Northwind.svc/Customers(123)
How the community answered
(23 responses)- A4% (1)
- B4% (1)
- C83% (19)
- D9% (2)
Explanation
OData supports the following HTTP actions to perform create, read, update, and delete operations on the entity data that the addressed resource represents: HTTP GET-This is the default action when a resource is accessed from a browser. No payload is supplied in the request message, and a response method with a payload that contains the requested data is returned. HTTP POST-Inserts new entity data into the supplied resource. Data to be inserted is supplied in the payload of the request message. The payload of the response message contains the data for the newly created entity. This includes any autogenerated key values. The header also contains the URI that addresses the new entity resource. HTTP DELETE- Deletes the entity data that the specified resource represents. A payload is not present in the request or response messages. HTTP PUT - Replaces existing entity data at the requested resource with new data that is supplied in the payload of the request message. HTTP MERGE-Because of inefficiencies in executing a delete followed by an insert in the data source just to change entity data, OData introduces a new HTTP MERGE action. The payload of the request message contains the properties that must be changed on the addressed entity resource. Because HTTP MERGE is not defined in the HTTP specification, it may require additional processing to route a HTTP MERGE request through non-OData aware servers. Accessing and Changing Data Using REST Semantics HTTP header fields Accept Content-Types that are acceptable Content-Type The mime type of the body of the request (used with POST and PUT requests) A Guide to Designing and Building RESTful WebServices with WCF 3.5 You are updating an existing Microsoft .NET Framework 4 application that includes a data layer built with ADO.NET Entity Framework 4. The application communicates with a Microsoft SQL Server 2008 instance named INST01 on a server named SQL01. The application stores data in a database named Contoso in the INST01 instance. You need to update the existing technology and develop new functionality by using Microsoft Visual Studio 2010. Application and Database Storage The application tracks bicycle parts as they pass through a factory. Parts are represented by the abstract Part entity and its associated partial classes. Each part has a name stored in the Name field and a unique identifier stored in the Id field. Parts are either component s (represented by the Component class) such as chains, wheels, and frames, or finished product s (represented by the Product class) such as completed bicycles. The Component class and the Product class derive from the Part class and may contain additional class-specific properties. Parts may have a color (represented by the Color class), but not all parts have a color, Parts may be composed of other parts, and those parts may in turn be composed of other parts ; any p art represents a tree of the parts that are used to build it, The lowest level of the tree consists of c omponents that do not contain other components. A product is a p art that has been completed and is ready to leave the factory. A p roduct typically consists of many c omponents (forming a tree of child p arts) but can also be constructed by combining other p roducts and/or c omponents to form a bundled p roduct, such as a bicycle and a helmet that are sold together. C omponents and p roducts are stored in a database table named Parts by using a table-per- hierarchy (TPH) mapping. Components have a null ProductType field and a non-null PartType field. Products have a non-null ProductType field and a null PartType field. The following diagram illustrates the complete Entity data model diagram (EDMX diagram), The following graphic illustrates detail s of the Part-Color Association. The following code segments show relevant portions of the files referenced by the case study items. (Line numbers in the samples below are included for reference only and include a two- character prefix that denotes the specific file to which they belong.) Extension Methods.vb Model/Component.vb ModelContosoEntities.vb Model Product.vb
Topics
Community Discussion
No community discussion yet for this question.
