Envisioning and Designing an Application
Questions derived from the 70-547VB – PRO: Designing and Developing Web-Based Applications by Using the Microsoft .NET Framework (VB.NET).
Self-Test Software Practice Test
Objective: Envisioning and Designing an Application
SubObjective: Create a proof-of-concept prototype
Item Number: 70-547VB.1.2.1
Multiple Answer, Multiple Choice
You develop Web-based applications. You have an application that accesses inventory data from your Microsoft SQL Server 2005 database. Your application retrieves a few rows of data from the Products table that contains more than 50,000 rows. The application uses the quantity value for each product to make determinations about purchases for raw materials. You want to ensure the application has the most updated data without using too many SQL Server resources.
Which actions should you take? (Choose two. Each answer represents part of the complete solution.)
- Create a SqlCacheDependency for the data.
- Create a static cursor that fetches rows matching the specific criteria.
- Call SqlDependency.Startmethod in your application.
- Create a forward-only cursor that fetches rows matching the specific criteria.
- Store a DataReaderin the Cache object on the server.
- Create a DataReader on the client that uses the application.
A. Create a SqlCacheDependency for the data.
C. Call SqlDependency.Startmethod in your application.
You should create a SqlCacheDependency for the data. The SqlCacheDependency class can be used to create a dependency between cached data and data in an underlying database. ASP.NET 2.0 Caching first checks whether the data is already cached. If it is, then the data is retrieved from cache. If the data is not cached, the data is retrieved from the database and cached for later use. SQL Server 2005 is able to create an indexed view when a query for which the client wants to create a dependency is executed. If the results returned by a query would change, SQL Server 2005 can detect this situation and send a message to the client via a Service Broker. The Notification events sent from SQL Server to an application program let the client know the data has changed. For an application to notify a client of changes, you must first enable the Query Notifications support in your client by calling the SqlDependency.Startmethod in the application.
You should not create a static cursor. A static cursor will not be able to detect changes to the underlying data. Static cursors access the data as it was when the cursor was opened. Also, a static cursor will consume significant resources.
A forward-only cursor may use fewer resources than a static cursor. However, a forward-only cursor will be only able to search forward through the result set. Thus, if the application used a forward-only cursor, the application would not be able to detect changes in the data that were in earlier records in the underlying result set.
You should not store a DataReader in the Cache object or create a DataReaderon the client that uses the application. A DataReader object will not be able to detect changes in the data. A DataReader object is used to read a forward-only stream of data from an underlying data source. Because is a retrieval mechanism and not data itself, caching a DataReader object does not offer any performance benefit.