nerdexam
Microsoft

70-516 · Question #5

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server 2008 database. You create classes by using LINQ to SQ

The correct answer is A. from details in dataContext.Order_Detail D. dataContext.Orders.GroupJoin(dataContext.Order_Detail,. Alterantive A. This is an Object Query. It looks at the Order Details EntitySet and creating a group g based on OrderID. - The group g is then joined with Orders EntitySet based on g.Key = OrderID - For each matching records a new dynamic object containing OrderID, CustomerID and

advanced WCF features

Question

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server 2008 database. You create classes by using LINQ to SQL based on the records shown in the exhibit:

You need to create a LINQ query to retrieve a list of objects that contains the OrderID and CustomerID properties. You need to retrieve the total price amount of each Order record. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

Exhibit

70-516 question #5 exhibit

Options

  • Afrom details in dataContext.Order_Detail
  • BdataContext.Order_Detail.GroupJoin(dataContext.Orders,
  • Cfrom order in dataContext.Orders
  • DdataContext.Orders.GroupJoin(dataContext.Order_Detail,

How the community answered

(28 responses)
  • A
    75% (21)
  • B
    7% (2)
  • C
    18% (5)

Explanation

Alterantive A. This is an Object Query. It looks at the Order Details EntitySet and creating a group g based on OrderID. - The group g is then joined with Orders EntitySet based on g.Key = OrderID - For each matching records a new dynamic object containing OrderID, CustomerID and TotalAmount is created. - The dynamic records are the results returned in an INumerable Object, for later processing AlterantiveD. This is an Object Query. The GroupJoin method is used to join Orders to Parameters for GroupJoin: 1. An Order_Details EntitySet 2. Order o (from the Orders in the Orders Entity Set, picking up Order_id from both Entity Sets) 3. Order_ID from the first Order_Details record from the OD EnitySet 4. Lamda Expression passing ord and dts (ord=o, dts=d) The body of the Lamda Expression is working out the total and Returning a Dynamic object as in A.

Topics

#LINQ to SQL#GroupJoin#aggregation#OrderID

Community Discussion

No community discussion yet for this question.

Full 70-516 Practice