xpo-devexpress-dot-xpo-dot-xpqueryextensions-dot-queryintransaction-1-x28-devexpress-dot-xpo-dot-session-x29.md
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
public static XPQuery<T> QueryInTransaction<T>(
this Session session
)
<ExtensionAttribute>
Public Shared Function QueryInTransaction(Of T)(
session As Session
) As XPQuery(Of T)
| Name | Type | Description |
|---|---|---|
| session | Session |
A Session object or its descendant, which instantiates an XPQuery<T>. The specified session is assigned to the XPQueryBase.Session property.
|
| Name |
|---|
| T |
| Type | Description |
|---|---|
| XPQuery<T> |
An XPQuery<T> object, instantiated from the session‘s scope, with the InTransaction mode enabled.
|
Example:
using System.Linq;
using DevExpress.Xpo;
// ...
var data = from c in session1.QueryInTransaction<Person>()
where c.LastName.StartsWith("A")
select c;
'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