DataCacheConfiguration Class
Contains configuration settings for cached data stores.
Namespace: DevExpress.Xpo.DB.Helpers
Assembly: DevExpress.Data.v24.2.dll
NuGet Package: DevExpress.Data
#Declaration
#Related API Members
The following members return DataCacheConfiguration objects:
#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 Data