Back to Devexpress

XPQueryExtensions.Query<T>(Session) Method

xpo-devexpress-dot-xpo-dot-xpqueryextensions-dot-query-1-x28-devexpress-dot-xpo-dot-session-x29.md

latest2.2 KB
Original Source

XPQueryExtensions.Query<T>(Session) Method

Creates a new XPQuery<T> instance from a specified session’s scope.

Namespace : DevExpress.Xpo

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public static XPQuery<T> Query<T>(
    this Session session
)
vb
<ExtensionAttribute>
Public Shared Function Query(Of T)(
    session As Session
) As XPQuery(Of T)

Parameters

NameTypeDescription
sessionSession

A Session object or its descendant, which instantiates an XPQuery<T>. The specified session is assigned to the XPQueryBase.Session property.

|

Type Parameters

Name
T

Returns

TypeDescription
XPQuery<T>

An XPQuery<T> object instantiated from the session‘s scope.

|

Remarks

Example:

csharp
using System.Linq;
using DevExpress.Xpo;

// ...

var data = from c in session1.Query<Person>()
           where c.LastName.StartsWith("A")
           select c;
vb
'NOTE: This code snippet uses implicit typing. 
'You will need to set 'Option Infer On' in the VB file or set 'Option Infer' at the project level:

Imports System.Linq
Imports DevExpress.Xpo

' ...

Private data = from c in session1.Query(Of Person)() where c.LastName.StartsWith("A") select c

See Also

XPQueryExtensions Class

XPQueryExtensions Members

DevExpress.Xpo Namespace