Gets or sets a semicolon-delimited string that indicates which databases and tables to use for the Microsoft SQL Server cache dependency.
Assembly: System.Web (in System.Web.dll)
SQL Server supports two mechanisms for cache invalidation: polling and notification. Each mechanism has a different syntax for the SqlCacheDependency object.
The ObjectDataSource supports only polling. The SqlCacheDependency string is used to create a SqlDependency object that is passed to the DbCommand constructor before the Select method is executed. The string identifies databases and tables according to the same format that is used by the @ Page directive, where the first part of the string is a connection string to a SQL Server database, followed by a colon delimiter, and finally the name of the database table (for example, "connectionstring1:table1"). If the property depends on more than one table, the connection string and table name pairs are separated by semicolons (for example, "connectionstring1:table1";connectionstring2:table2").
This section contains two code examples. The first code example demonstrates how to create a SQL Server cache dependency and set the ObjectDataSource object. The second code example demonstrates how to implement a wrapper method that returns a DataSet object to enable caching and filtering with an ObjectDataSource object.property of a
The following code example demonstrates how to create a SQL Server cache dependency and set the ObjectDataSource control. In this example, the database is polled every 120 seconds. If the data in the Northwind Traders Employees table changes during that time, any data that is cached by the ObjectDataSource control and displayed by the GridView control is expired and a new set of data is retrieved on the next request for the page.property of a
The following code example demonstrates how to implement a wrapper method that returns a DataSet object to enable caching and filtering with an ObjectDataSource control. In the base implementation of the EmployeeLogic class, the GetAllEmployees method returns an ArrayList object. Instead of refactoring the object completely to work with the ObjectDataSource on a Web Forms page, a wrapper method named GetAllEmployeesAsDataSet is added that returns a set of NorthwindEmployee data as a DataSet.
Available since 2.0