.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

Session.Connect(IObjectLayer, IDisposable[]) Method

Connects the session to a data store using a specified object access layer.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v21.2.dll


public void Connect(
    IObjectLayer layer,
    params IDisposable[] disposeOnDisconnect


Name Type Description
layer IObjectLayer

An object implementing the IObjectLayer interface. This object is assigned to the session’s Session.ObjectLayer property.

disposeOnDisconnect IDisposable[]

An array of objects to be automatically disposed of when the session is disconnected from a data store.


Call this method to connect the current session to a data store via the layer, ignoring the session’s Session.ConnectionString and Session.Connection property settings.

The Connect method automatically assigns the layer to the session’s Session.ObjectLayer property. In addition, the session’s Session.Dictionary property is assigned the layer‘s Dictionary property value.


The Connect method throws an exception if any of the following conditions are met:

  • The session is already connected to a data store.
  • Null (Nothing in Visual Basic) is passed as the layer.
See Also