DataCacheConfiguration Class
Contains configuration settings for cached data stores.
Namespace: DevExpress.Xpo.DB.Helpers
Assembly: DevExpress.Data.v18.1.dll
Declaration
Related API Members
The following members accept/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 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.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DataCacheConfiguration class.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.