Back to Devexpress

DataStoreClientAsync Class

xpo-devexpress-dot-xpo-dot-db-35dac124.md

latest4.4 KB
Original Source

DataStoreClientAsync Class

A data store provider that client applications can use to asynchronously work with the data source via WCF.

Namespace : DevExpress.Xpo.DB

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public class DataStoreClientAsync :
    DataStoreClientAsyncBase<IDataStoreWarpServiceAsync>
vb
Public Class DataStoreClientAsync
    Inherits DataStoreClientAsyncBase(Of IDataStoreWarpServiceAsync)

Remarks

A DataStoreClientAsync instance can be created using the XpoDefault.GetConnectionProvider method if you pass a connection string to a service (an IDataStoreService implementor, such as a DataStoreService descendant) as a method parameter. DataStoreClientAsync objects are automatically created to maintain a data store connection on the client side when you create a data layer via the XpoDefault.GetDataLayer method call with a connection string to a service. The client created in this manner uses BasicHttpBinding configured with default parameters except for MaxReceivedMessageSize and ReaderQuotas, which are set to maximum values.

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

// GetDataLayer automatically creates a data store provider 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 data store provider based on the connection string.
XpoDefault.DataLayer = XpoDefault.GetDataLayer(connectionString, AutoCreateOption.DatabaseAndSchema)
XpoDefault.Session = Nothing

To use a specific endpoint and binding configurations, create the DataStoreClientAsync object using a constructor and pass either the configuration name or programmatically configured endpoint and binding objects.

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

// Creating a data store provider.
IDataStoreAsync dataStoreAsync = new DataStoreClientAsync(bindingName);
// Checking connection.
dataStore.AutoCreateOption.ToString();

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

' Creating a data store provider.
Dim dataStoreAsync As IDataStoreAsync = New DataStoreClientAsync(bindingName)
' Checking connection.
dataStore.AutoCreateOption.ToString()

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

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

Inheritance

Object ClientBase<IDataStoreWarpServiceAsync> DevExpress.Xpo.DB.DataStoreClientBase<IDataStoreWarpServiceAsync> DevExpress.Xpo.DB.DataStoreClientAsyncBase<IDataStoreWarpServiceAsync> DataStoreClientAsync

See Also

DataStoreClientAsync Members

DevExpress.Xpo.DB Namespace