Back to Devexpress

CachedDataStoreClient Class

xpo-devexpress-dot-xpo-dot-db-1a89a231.md

latest4.2 KB
Original Source

CachedDataStoreClient Class

A cached data store provider (an ICachedDataStore implementation) for client applications transferring data via WCF.

Namespace : DevExpress.Xpo.DB

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public class CachedDataStoreClient :
    CachedDataStoreClientBase<ICachedDataStoreWarpService>
vb
Public Class CachedDataStoreClient
    Inherits CachedDataStoreClientBase(Of ICachedDataStoreWarpService)

Remarks

CachedDataStoreClient objects are automatically created to maintain a cache (DataCacheNode) on the client side when you create a data layer via the XpoDefault.GetDataLayer method call and pass a connection string to a service (an ICachedDataStoreService implementor, such as a CachedDataStoreService descendant) as a method parameter.

csharp
// Sample WCF service connection string.
string connectionString = "http://localhost:64466/Service.svc";

// GetDataLayer automatically creates 
// a cached data store provider (and a cache) based on the connection string.
XpoDefault.DataLayer = XpoDefault.GetDataLayer(connectionString, AutoCreateOption.DatabaseAndSchema);
XpoDefault.Session = null;
vb
' Sample WCF service connection string.
Dim connectionString As String = "http://localhost:64466/Service.svc"

' GetDataLayer automatically creates 
' a cached data store provider (and a cache) based on the connection string.
XpoDefault.DataLayer = XpoDefault.GetDataLayer(connectionString, AutoCreateOption.DatabaseAndSchema)
XpoDefault.Session = Nothing

If you are going to create a cache hierarchy at the client, you can manually create CachedDataStoreClient objects as shown below.

csharp
// Specifying the name of the endpoint in the client application's configuration file.
string bindingName = "...";

// Creating a cache (a node starting a cache hierarchy at the client).
DataCacheNode node = new DataCacheNode(new CachedDataStoreClient(bindingName));
// Checking connection.
node.ProcessCookie(DataCacheCookie.Empty);

XpoDefault.DataLayer = new SimpleDataLayer(node);
XpoDefault.Session = null;
vb
' Specifying the name of the endpoint in the client application's configuration file.
Dim bindingName As String = "..."

' Creating a cache (a node starting a cache hierarchy at the client).
Dim node As New DataCacheNode(New CachedDataStoreClient(bindingName))
' Checking connection.
node.ProcessCookie(DataCacheCookie.Empty)

XpoDefault.DataLayer = New SimpleDataLayer(node)
XpoDefault.Session = Nothing

For more information on transferring data via WCF services, refer to Transferring Data via WCF Services.

Inheritance

Object ClientBase<ICachedDataStoreWarpService> DevExpress.Xpo.DB.DataStoreClientBase<ICachedDataStoreWarpService> DevExpress.Xpo.DB.CachedDataStoreClientBase<ICachedDataStoreWarpService> CachedDataStoreClient

See Also

CachedDataStoreClient Members

DevExpress.Xpo.DB Namespace