Back to Devexpress

XPBaseCollection.Session Property

xpo-devexpress-dot-xpo-dot-xpbasecollection-5199031f.md

latest4.0 KB
Original Source

XPBaseCollection.Session Property

Gets or sets the Session used by the current collection.

Namespace : DevExpress.Xpo

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public Session Session { get; set; }
vb
Public Property Session As Session

Property Value

TypeDescription
Session

The session with a connection to a data source. The default value is Session.DefaultSession.

|

Remarks

Do not change this property value manually in your code, as it is intended to provide design-time support for the component. If you need to create the XPColleciton in the designer but specify the Session in code, use the XPBaseCollection.ResolveSession event. In the XPBaseCollection descendants (XPCollection and XPCollection<T>), you can also pass the Session object to the constructor.

The following code snippets (auto-collected from DevExpress Examples) contain references 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.

xaf-how-to-display-a-collection-property-as-a-checked-list-box/CS/DXExample.Module.Win/WinCheckedListBoxPropertyEditor.cs#L25

csharp
checkedItems = (XPBaseCollection)PropertyValue;
XPCollection dataSource = new XPCollection(checkedItems.Session, MemberInfo.ListElementType);
IModelClass classInfo = application.Model.BOModel.GetClass(MemberInfo.ListElementTypeInfo.Type);

reporting-winforms-custom-report-storage/CS/XpoReportStorage.cs#L16

csharp
UnitOfWork Session {
    get { return (UnitOfWork)items.Session; }
}

xaf-how-to-display-a-collection-property-as-a-checked-list-box/VB/DXExample.Module.Win/WinCheckedListBoxPropertyEditor.vb#L29

vb
checkedItems = CType(PropertyValue, XPBaseCollection)
Dim dataSource As New XPCollection(checkedItems.Session, MemberInfo.ListElementType)
Dim classInfo As IModelClass = application.Model.BOModel.GetClass(MemberInfo.ListElementTypeInfo.Type)

reporting-winforms-custom-report-storage/VB/XpoReportStorage.vb#L19

vb
Get
    Return CType(items_Renamed.Session, UnitOfWork)
End Get

See Also

XPBaseCollection Class

XPBaseCollection Members

DevExpress.Xpo Namespace