corelibraries-devexpress-dot-xpo-dot-db-dot-helpers-8ec151dc.md
Contains configuration settings for cached data stores.
Namespace : DevExpress.Xpo.DB.Helpers
Assembly : DevExpress.Data.v25.2.dll
NuGet Package : DevExpress.Data
public class DataCacheConfiguration
Public Class DataCacheConfiguration
The following members return DataCacheConfiguration objects:
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
);
Imports DevExpress.Xpo
Imports DevExpress.Xpo.DB
Imports DevExpress.Xpo.DB.Helpers
' ...
Private connectionString As String = _
MSSqlConnectionProvider.GetConnectionString("localhost", "SampleDB")
Private provider As MSSqlConnectionProvider = CType( _
XpoDefault.GetConnectionProvider(connectionString, AutoCreateOption.DatabaseAndSchema), _
MSSqlConnectionProvider)
Private cacheConfig As New DataCacheConfiguration(DataCacheConfigurationCaching.InList, _
"Customers", "Departments")
' Configuring DataCacheRoot
Private cacheRoot As New DataCacheRoot(provider)
cacheRoot.Configure(cacheConfig)
' Configuring MSSql2005SqlDependencyCacheRoot
Dim objectsToDispose() As IDisposable
Dim cachedDataStore As ICachedDataStore = CType( _
MSSql2005SqlDependencyCacheRoot.CreateSqlDependencyCacheRoot( _
provider, cacheConfig, objectsToDispose), ICachedDataStore)
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.
Object DataCacheConfiguration
See Also