Back to Devexpress

FetchDataEventArgs.GetFetchExpression<T>() Method

wpf-devexpress-dot-xpf-dot-scheduling-dot-fetchdataeventargs-dot-getfetchexpression-1.md

latest3.3 KB
Original Source

FetchDataEventArgs.GetFetchExpression<T>() Method

Generates an expression that you can use to obtain appointments from the data source.

Namespace : DevExpress.Xpf.Scheduling

Assembly : DevExpress.Xpf.Scheduling.v25.2.dll

NuGet Package : DevExpress.Wpf.Scheduling

Declaration

csharp
public Expression<Func<T, bool>> GetFetchExpression<T>()
vb
Public Function GetFetchExpression(Of T) As Expression(Of Func(Of T, Boolean))

Type Parameters

Name
T

Returns

TypeDescription
Expression<Func<T, Boolean>>

An expression that you can use to obtain appointments from the data source.

|

Remarks

The code snippet below illustrates how to use the GetFetchExpression method to implement the FetchAppointments event.

csharp
public void FetchAppointments(FetchDataEventArgs args) {
  using(var dbContext = new SchedulingContext()) {
      args.AsyncResult = dbContext.AppointmentEntities
      .Where(args.GetFetchExpression<AppointmentEntity>())
      .ToArrayAsync();
  }
}
vb
Public Sub FetchAppointments(ByVal args As FetchDataEventArgs)
  Using dbContext = New SchedulingContext()
      Dim res = dbContext.AppointmentEntities.Where(args.GetFetchExpression(Of AppointmentEntity)())
      args.AsyncResult = QueryableExtensions.ToArrayAsync(Of Object)(res)
  End Using
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetFetchExpression<T>() method.

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.

wpf-scheduler-load-data-on-demand/VB/CommonDbContext/ViewModels/SchedulingViewModel.vb#L22

vb
Public Sub FetchAppointments(ByVal args As FetchDataEventArgs)
    Dim res = dbContext.AppointmentEntities.Where(args.GetFetchExpression(Of AppointmentEntity)())
    args.AsyncResult = QueryableExtensions.ToArrayAsync(Of Object)(res)

See Also

FetchDataEventArgs Class

FetchDataEventArgs Members

DevExpress.Xpf.Scheduling Namespace