Back to Devexpress

XPQueryExtensions.QueryInTransaction<T>(Session) Method

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

latest2.4 KB
Original Source

XPQueryExtensions.QueryInTransaction<T>(Session) Method

Creates a new XPQuery<T> instance with the InTransaction (XPQuery<T>.InTransaction) mode enabled, 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> QueryInTransaction<T>(
    this Session session
)
vb
<ExtensionAttribute>
Public Shared Function QueryInTransaction(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, with the InTransaction mode enabled.

|

Remarks

Example:

csharp
using System.Linq;
using DevExpress.Xpo;

// ...

var data = from c in session1.QueryInTransaction<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.QueryInTransaction(Of Person)() _
where c.LastName.StartsWith("A") _
select c

See Also

XPQueryExtensions Class

XPQueryExtensions Members

DevExpress.Xpo Namespace