nerdexam
Microsoft

70-516 · Question #195

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses the Entity Framework. The application has an entity model that contains a SalesOrderHeader…

The correct answer is C. var model = new AdventureWorksEntities(). OrderBy() Sorts the elements of a sequence in ascending order according to a key. OrderByDescending() Sorts the elements of a sequence in descending order according to a key. Enumerable.OrderBy<TSource, TKey> Method (IEnumerable<TSource>, Func<TSource, TKey>)

Querying Data

Question

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses the Entity Framework. The application has an entity model that contains a SalesOrderHeader entity. The entity includes an OrderDate property of type DateTime. You need to retrieve the 10 oldest SalesOrderHeaders according to the OrderDate property. Which code segment should you use?

Options

  • Avar model = new AdventureWorksEntities();
  • Bvar model = new AdventureWorksEntities();
  • Cvar model = new AdventureWorksEntities();
  • Dvar model = new AdventureWorksEntities();

How the community answered

(46 responses)
  • A
    4% (2)
  • B
    9% (4)
  • C
    85% (39)
  • D
    2% (1)

Explanation

OrderBy() Sorts the elements of a sequence in ascending order according to a key. OrderByDescending() Sorts the elements of a sequence in descending order according to a key. Enumerable.OrderBy<TSource, TKey> Method (IEnumerable<TSource>, Func<TSource, TKey>)

Topics

#Entity Framework#LINQ#ordering#Take

Community Discussion

No community discussion yet for this question.

Full 70-516 Practice