xpo-devexpress-dot-xpo-dot-xpobjectsource-83617368.md
Occurs when the XPObjectSource needs a Session to retrieve objects from the data store.
Namespace : DevExpress.Xpo
Assembly : DevExpress.DataAccess.v25.2.dll
NuGet Package : DevExpress.DataAccess
public event EventHandler<ResolveSessionEventArgs> ResolveSession
Public Event ResolveSession As EventHandler(Of ResolveSessionEventArgs)
The ResolveSession event's data class is ResolveSessionEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Session | Specifies the session to be used to load and save persistent objects. |
Handle this event to supply a Session connected to the required data store. You can also handle the XPObjectSource.DismissSession event to dispose of the created session if required. In the ResolveSession event handler, you can pass an arbitrary object to the XPObjectSource.Tag property and then use this object in the DismissSession event handler.
If the ResolveSession event is not handled, the XPObjectSource instantiates a Session using settings specified via the XPObjectSource.ConnectionString or XPObjectSource.ConnectionStringName properties.
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ResolveSession event.
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.
winforms-reporting-create-report-bound-to-xpobjectsource/CS/Form1.cs#L73
XPObjectSource dataSource = (XPObjectSource)report.DataSource;
dataSource.ResolveSession += new EventHandler<ResolveSessionEventArgs>(OnResolveSession);
dataSource.DismissSession += new EventHandler<ResolveSessionEventArgs>(OnDismissSession);
winforms-reporting-create-report-bound-to-xpobjectsource/VB/Form1.vb#L72
Dim dataSource As XPObjectSource = CType(report.DataSource, XPObjectSource)
AddHandler dataSource.ResolveSession, AddressOf OnResolveSession
AddHandler dataSource.DismissSession, AddressOf OnDismissSession
See Also