DataCacheConfiguration Class

Contains configuration settings for cached data stores.

Namespace: DevExpress.Xpo.DB.Helpers

Assembly: DevExpress.Data.v19.2.dll

Declaration

public class DataCacheConfiguration
Public Class DataCacheConfiguration

Remarks

A DataCacheConfiguration object instance is used to configure a cached data store using a Root element's DataCacheRoot.Configure method. For the MSSql2005SqlDependencyCacheRoot, call the corresponding MSSql2005SqlDependencyCacheRoot.CreateSqlDependencyCacheRoot overloaded method.


using DevExpress.Xpo;
using DevExpress.Xpo.DB;
using DevExpress.Xpo.DB.Helpers;

// ...
string connectionString = MSSqlConnectionProvider.GetConnectionString("localhost", "SampleDB");
MSSqlConnectionProvider provider = (MSSqlConnectionProvider)XpoDefault.GetConnectionProvider(
    connectionString,
    AutoCreateOption.DatabaseAndSchema
);
DataCacheConfiguration cacheConfig = new DataCacheConfiguration(
    DataCacheConfigurationCaching.InList, "Customers", "Departments");

// Configuring DataCacheRoot
DataCacheRoot cacheRoot = new DataCacheRoot(provider);
cacheRoot.Configure(cacheConfig);

// Configuring MSSql2005SqlDependencyCacheRoot
IDisposable[] objectsToDispose;
ICachedDataStore cachedDataStore = 
    (ICachedDataStore)MSSql2005SqlDependencyCacheRoot.CreateSqlDependencyCacheRoot(
    provider,
    cacheConfig,
    out objectsToDispose
);
TIP

To cache all tables, pass the All enumeration value to the DataCacheConfiguration.Caching property. All tables will be cached in this instance, regardless of their inclusion in the configuration settings. To cache all tables except for the tables specified, use the NotInList value.

Inheritance

Object
DataCacheConfiguration
See Also