PrepAway - Latest Free Exam Questions & Answers

Which object should you use?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server database. You use Entity SQL to retrieve data from the database.
You need to enable query plan caching. Which object should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
EntityCommand

B.
EntityConnection

C.
EntityTransaction

D.
EntityDataReader

Explanation:
Whenever an attempt to execute a query is made, the query pipeline looks up its query plan cache to see whether the exact query is already compiled and available.
If so, it reuses the cached plan rather than building a new one. If a match is not found in the query plan cache, the query is compiled and cached.
A query is identified by its Entity SQL text and parameter collection (names and types). All text comparisons are case-sensitive.

Query plan caching is configurable through the EntityCommand.
To enable or disable query plan caching through System.Data.EntityClient.EntityCommand.EnablePlanCaching, set this property to true or false.
Disabling plan caching for individual dynamic queries that are unlikely to be used more then once improves performance.
You can enable query plan caching through EnablePlanCaching.

Query Plan Caching
(http://msdn.microsoft.com/en-us/library/bb738562.aspx)


Leave a Reply