Back to Devexpress

Session.Connection Property

xpo-devexpress-dot-xpo-dot-session-df5abbb0.md

latest2.3 KB
Original Source

Session.Connection Property

Gets or sets an IDbConnection object associated with the session.

Namespace : DevExpress.Xpo

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
[DefaultValue(null)]
public IDbConnection Connection { get; set; }
vb
<DefaultValue(Nothing)>
Public Property Connection As IDbConnection

Property Value

TypeDefaultDescription
IDbConnectionnull

An object which implements the IDbConnection interface.

|

Remarks

Use the OleDbConnection to access an Microsoft Access database and the SqlConnection to access an Microsoft SQL Server database.

Setting the Connection property throws the CannotChangePropertyWhenSessionIsConnectedException if the session is already connected to a database. Otherwise, it resets the Session.ConnectionString property’s value.

The Connection property returns null (Nothing in VB) if the pooled database connection with the Cached Data Store and Object Access Layer (DevExpress.Xpo.SessionObjectLayer or SerializableObjectLayerClient) is used.

See Also

ConnectionString

Connect

Session Class

Session Members

DevExpress.Xpo Namespace