Session.Connect(IObjectLayer, IDisposable[]) Method
Connects the session to a data store using a specified object access layer.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v24.2.dll
NuGet Package: DevExpress.Xpo
#Declaration
public void Connect(
IObjectLayer layer,
params IDisposable[] disposeOnDisconnect
)
#Parameters
Name | Type | Description |
---|---|---|
layer | IObject |
An object implementing the IObject |
dispose |
IDisposable[] | An array of objects to be automatically disposed of when the session is disconnected from a data store. |
#Remarks
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.
Note
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.