Back to Devexpress

SerializableObjectLayerServiceClient Class

xpo-devexpress-dot-xpo-dot-db-ff05d269.md

latest4.7 KB
Original Source

SerializableObjectLayerServiceClient Class

A distributed object access layer (an ISerializableObjectLayer 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 SerializableObjectLayerServiceClient :
    SerializableObjectLayerServiceClientBase<ISerializableObjectLayerService>
vb
Public Class SerializableObjectLayerServiceClient
    Inherits SerializableObjectLayerServiceClientBase(Of ISerializableObjectLayerService)

Remarks

Normally, all you have to do is initialize a SerializableObjectLayerServiceClient with a service endpoint in the client application, as shown below.

csharp
// (ObjectWcfClient.cs)
class Program {
    static void Main(string[] args) {
        // Creating a distributed object layer based on data retrieved via a WCF service.
        // The service endpoint is obtained from the client application's App.config file.
        ISerializableObjectLayer serializableObjectLayer = new 
            SerializableObjectLayerServiceClient("BasicHttpBinding_ISerializableObjectLayerService");

        // Checking connection.
        serializableObjectLayer.CanLoadCollectionObjects.ToString();

        XpoDefault.DataLayer = null;
        XpoDefault.Session = null;
        // Instantiates an object access layer used to retrieve and update object data 
        // in a data store exposed via a WCF service.
        ObjectHelper.ObjectLayer = new SerializableObjectLayerClient(serializableObjectLayer);

        using(UnitOfWork uow = new UnitOfWork(ObjectHelper.ObjectLayer)) {
            // Object data manipulations.
            // ...
        }
    }
}
public static class ObjectHelper {
    public static IObjectLayer ObjectLayer;
}
vb
' (ObjectWcfClient.vb)
Friend Class Program
    Shared Sub Main(ByVal args() As String)
        ' Creating a distributed object layer based on data retrieved via a WCF service.
        ' The service endpoint is obtained from the client application's App.config file.
        Dim serializableObjectLayer As ISerializableObjectLayer = New _
        SerializableObjectLayerServiceClient("BasicHttpBinding_ISerializableObjectLayerService")

        ' Checking connection.
        serializableObjectLayer.CanLoadCollectionObjects.ToString()

        XpoDefault.DataLayer = Nothing
        XpoDefault.Session = Nothing
        ' Instantiates an object access layer used to retrieve and update object data 
        ' in a data store exposed via a WCF service.
        ObjectHelper.ObjectLayer = New SerializableObjectLayerClient(serializableObjectLayer)

        Using uow As New UnitOfWork(ObjectHelper.ObjectLayer)
            ' Object data manipulations.
            ' ...
        End Using
    End Sub
End Class
Public NotInheritable Class ObjectHelper
    Public Shared ObjectLayer As IObjectLayer
End Class

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

Implements

ISerializableObjectLayer

ISerializableObjectLayerEx

Inheritance

Object ClientBase<ISerializableObjectLayerService> DevExpress.Xpo.DB.SerializableObjectLayerServiceClientBase<ISerializableObjectLayerService> SerializableObjectLayerServiceClient

See Also

SerializableObjectLayerServiceClient Members

ISerializableObjectLayerService

SerializableObjectLayerService

SerializableObjectLayerClient

DevExpress.Xpo.DB Namespace