wpf-devexpress-dot-xpf-dot-scheduling-dot-fetchdataeventargs-dot-getfetchexpression-1.md
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
public Expression<Func<T, bool>> GetFetchExpression<T>()
Public Function GetFetchExpression(Of T) As Expression(Of Func(Of T, Boolean))
| Name |
|---|
| T |
| Type | Description |
|---|---|
| Expression<Func<T, Boolean>> |
An expression that you can use to obtain appointments from the data source.
|
The code snippet below illustrates how to use the GetFetchExpression method to implement the FetchAppointments event.
public void FetchAppointments(FetchDataEventArgs args) {
using(var dbContext = new SchedulingContext()) {
args.AsyncResult = dbContext.AppointmentEntities
.Where(args.GetFetchExpression<AppointmentEntity>())
.ToArrayAsync();
}
}
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
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