Back to Devexpress

XpoDataSource.Session Property

xpo-devexpress-dot-xpo-dot-xpodatasource.md

latest2.9 KB
Original Source

XpoDataSource.Session Property

Gets or sets the Session used by the current data source control to load and save persistent objects.

Namespace : DevExpress.Xpo

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
[Browsable(false)]
public Session Session { get; set; }
vb
<Browsable(False)>
Public Property Session As Session

Property Value

TypeDescription
Session

A Session object connected to a data store.

|

Remarks

A session which the data source control will work with can be assigned within a page’s Init event handler.

csharp
using System;
using DevExpress.Xpo;
// ...
Session session1;
protected void Page_Init(object sender, EventArgs e) {
    session1 = new Session();
    XpoDataSource1.Session = session1;
}
vb
Imports System
Imports DevExpress.Xpo
' ...
Private session1 As Session
Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
    session1 = New Session()
    XpoDataSource1.Session = session1
End Sub

For more information on how to retrieve specific data, see How To: Connect XPO to a Database Server (ASP.NET WebForms).

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Session property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

XPO_how-to-create-web-service-supporting-the-data-level-caching-e2740/CS/Client/Default.aspx.cs#L7

csharp
protected void Page_Init(object sender, EventArgs e) {
    personSource.Session = XpoHelper.GetNewSesion();
}

See Also

XpoDataSource Class

XpoDataSource Members

DevExpress.Xpo Namespace