System.Web.UI.WebControls.ObjectDataSource.CacheKeyDependency Property

Gets or sets a user-defined key dependency that is linked to all data cache objects that are created by the data source control.

Syntax

[System.ComponentModel.DefaultValue("")]
public virtual string CacheKeyDependency { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

The ObjectDataSource.CacheKeyDependency property can be set to any arbitrary string value.

All cache objects are explicitly expired when the key is expired. This allows you to invalidate cache entries that are created by the System.Web.UI.WebControls.ObjectDataSource from your own page code programmatically.

The System.Web.UI.WebControls.ObjectDataSource control supports data caching. While data is cached, calls to the ObjectDataSource.Select method retrieve data from the cache rather than from the business object that the System.Web.UI.WebControls.ObjectDataSource works with. When the cache expires, the ObjectDataSource.Select method retrieves data from the business object, and then caches the data again.

The System.Web.UI.WebControls.ObjectDataSource control automatically caches data when the ObjectDataSource.EnableCaching property is set to true and the ObjectDataSource.CacheDuration property is set to a value greater than 0, which indicates the number of seconds that the cache stores data before the cache entry is discarded. A value of 0 indicates an infinitely long cache.

You can set the ObjectDataSource.CacheKeyDependency property to create a dependency between all cache entries that are created by the System.Web.UI.WebControls.ObjectDataSource control and the key. You can expire all the cache entries programmatically at any time by expiring the key. Expire the key by using the System.Web.Caching.Cache.Remove(string) method with the current ObjectDataSource.CacheKeyDependency value as the parameter.

A unique cache entry is created for every combination of the ObjectDataSource.CacheDuration, ObjectDataSource.CacheExpirationPolicy, ObjectDataSource.TypeName, ObjectDataSource.SelectMethod, and ObjectDataSource.SelectParameters properties. Multiple System.Web.UI.WebControls.ObjectDataSource controls can use the same cache entries in scenarios where they load data using the same type, method, and parameters.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0