Which code segment should you use?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application
that uses the Entity Framework. The application has the entity model shown in the following
diagram.

The application must create a projection of the unique set of names and year-to-date sales for
territories where at least one sales person had sales last year of more than $100,000. The projection
must consist of properties named Sales and Name. You need to write a query that will generate the
required projection. Which code segment should you use?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application
that uses the Entity Framework. The application has the entity model shown in the following
diagram.

The application must create a projection of the unique set of names and year-to-date sales for
territories where at least one sales person had sales last year of more than $100,000. The projection
must consist of properties named Sales and Name. You need to write a query that will generate the
required projection. Which code segment should you use?

A.
(From person In model.Salespersons
Where (person.SalesLastYear > 100000)
Select New With { _
person.SalesTerrltory.Name, _
.Soles = person.SalesTerritory.SalesYTD)). _
Distinct()

B.
(From person In model.Salespersons
Where (person.SalesLastYear > 100000)
Select New With_
.Name + person.SalesTerritory.Name,
.Sales = person.SalesTerritory.SalesYTD
}}

C.
model.SalesTerritones. _
Where(Function(territory) territory.Salespersons.Any(
Function(person) person.SalesLastYear > 100000)).
Select(Function(territory) Nera With {territory.Name,
territory.SalesYTD})
. Distinct()

D.
model.SalesTerritories. _

Where(Function(territory) territory.Salespersons.Any(
Function(person) person.SalesLastYear > 100000)_
. Select(Function(territory) New With {territory.Name,
Sales = territory.SalesYTD))



Leave a Reply 0

Your email address will not be published. Required fields are marked *