70-516 · Question #240
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database. You use the ADO.NET LINQ to SQL model to…
The correct answer is B. Using dc As New NorthwindDataContext(). DataLoadOptions Class Provides for immediate loading and filtering of related data. DataLoadOptions.LoadWith(LambdaExpression) Retrieves specified data related to the main target by using a lambda expression. You can retrieve many objects in one query by using LoadWith…
Question
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database. You use the ADO.NET LINQ to SQL model to retrieve data from the database. The application contains the Category and Product entities, as shown in the following exhibit. You need to ensure that LINQ to SQL executes only a single SQL statement against the database. You also need to ensure that the query retrieves the list of categories and the list of products. Which code segment should you use?
Exhibit
Options
- AUsing dc As New NorthwindDataContext()
- BUsing dc As New NorthwindDataContext()
- CUsing dc As New NorthwindDataContext()
- DUsing dc As New NorthwindDataContext()
How the community answered
(33 responses)- A6% (2)
- B82% (27)
- C3% (1)
- D9% (3)
Explanation
DataLoadOptions Class Provides for immediate loading and filtering of related data. DataLoadOptions.LoadWith(LambdaExpression) Retrieves specified data related to the main target by using a lambda expression. You can retrieve many objects in one query by using LoadWith. DataLoadOptions.AssociateWith(LambdaExpression) Filters the objects retrieved for a particular Use the AssociateWith method to specify sub-queries to limit the amount of retrieved data. DataLoadOptions Class How to: Retrieve Many Objects At Once (LINQ to SQL) How to: Filter Related Data (LINQ to SQL)
Topics
Community Discussion
No community discussion yet for this question.
