All docs
V21.1
21.2 (EAP/Beta)
21.1
20.2
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

XPQuery<T>.WithDeleted() Method

Creates an XPQuery<T> based on the current XPQuery<T> instance. The new query retrieves objects specified by the original query and also selects objects marked as deleted that match that query.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v21.1.dll

Declaration

public XPQuery<T> WithDeleted()

Returns

Type Description
XPQuery<T>

An XPQuery<T> instance.

Remarks

The following example demonstrates how to employ the WithDeleted method in an application:

unitOfWork.Query<Employee>()
    .WithDeleted()
    .Where(e => e.Name == null).ToList();

new XPQuery<Employee>(unitOfWork)
     .WithDeleted()
     .Where(e => e.Name == null).ToList();

To use the WithDeleted feature, make sure to initialize the XPQuery<T> with the XPQuery(Session) or XPQuery(Session, Boolean) constructor.

If you use a constructor that does not take the Session argument, the XPQuery<T> cannot get objects marked for deletion and the following error is displayed: “The WithDeleted option is not supported because XPQuery was initialized with DataLayer. To use the WithDeleted option, employ the XPQuery(Session) or XPQuery(Session, Boolean) constructor.

See Also