Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Collapse]Scheduler
   [Expand]Product Information
   [Expand]Getting Started
   [Collapse]Fundamentals
    [Expand]Scheduler Elements
    [Expand]Scheduler Structure
    [Expand]Appointments
     Resources for Appointments
    [Expand]Views
    [Collapse]Data Binding
     [Expand]Data Sources
      FetchAppointments Event - Handling Large Datasets
    [Expand]Mappings
    [Expand]Supported Formats
    [Expand]Services
    [Expand]Time Zones
     Printing
    [Expand]Scheduler Reporting
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

FetchAppointments Event - Handling Large Datasets

Expanded Overview

This topic describes a technique for minimizing data queried by the SchedulerStorage from its external data source. This approach may significantly improve the performance of a scheduling application.

To do this, you can handle the SchedulerStorageBase.FetchAppointments event, which is capable of filtering and prefetching data.

Expanded FetchAppointments Event in Detail

The FetchAppointments event is designed to reduce the amount of data fetched from the data source at one time. When the Scheduler changes its visible time interval, it requests Storage for the displayed appointments. If the FetchAppointments event is handled, the event handler fetches appointments; otherwise, the SchedulerStorage component operates according to its built-in logic - the SchedulerStorage has a cache that contains previously fetched appointments. Note that cache operations may retrieve an excessive amount of appointment data. By handling the FetchAppointment event, you can implement your own logic for populating the data source, thus reducing the amount of appointments data retrieves.

A parameterized query should be used to fill the data adapters with data. In this instance, the query fetches appointment data for the required time intervals only. You can decide to extend the time interval to ensure prefetching, and fill the SchedulerStorage's appointment cache with extra data. The implementation depends on the view the user is switching to, and the assumptions as to how the user will navigate dates.

Note that all requested time intervals should be populated with data, and it does not make sense to differentiate, or even prevent, specific data from being fetched. The task is to optimize data access, and not to prevent data for specific intervals from being fetched at all. You can implement an appropriate caching strategy, as there is no general solution for all cases.

If the SchedulerStorageBase.FetchAppointments event is handled, the Scheduler does not rely on its own, built-in caching strategy. The FetchAppointments event occurs in situations that do not involve changes in the displayed data, such as control resizing. To improve performance, treat these cases as your needs dictate, and decide whether to query the data source for appointment data again or leave the Storage data intact.

Note

To minimize the amount of data loaded, and decrease the number of queries from the FetchAppointments event handler, do not highlight days with appointments in the DateNavigator control (set the DateNavigator.BoldAppointmentDates property to false).

Expanded EnableSmartFetch Option

Recently, the FetchAppointments event occurs too often when appointment are being inserted/deleted/modified, on visible interval changing and in other situations. It caused several problems.

Starting with version 15.2, the FetchAppointments event occurs when the visible interval or resource collection is changed, or when the SchedulerControl.RefreshData method is called. However the event is not raised for appointment changes.

The SchedulerStorageBase.EnableSmartFetch property regulates this behavior. The property is true by default to ensure that the FetchAppointments event occurs in the situations described above. To restore the former behavior of the FetchAppointments event set the EnableSmartFetch property to false.

Expanded Special Notes on Recurring Appointments

Recurring appointment is a special case. A recurring appointment series is never stored in the underlying data source. The data source only contains records for the pattern, and changed and deleted appointments. For example, you have 3 pattern appointments, where each appointment generates a series of 10 regular appointments. Thus, only 3 pattern appointments are stored in the underlying data source, in place of 30 appointments. When a pattern appointment is loaded into the SchedulerControl, the control calculates the recurring series and displays appointments from the series in the active view.

Once you change or delete any appointment from that series, a new appointment is created with a corresponding Appointment.Type - AppointmentType.ChangedOccurrence (value = 3) or AppointmentType.DeletedOccurrence (value = 4 ), and this appointment is stored in the data source as a separate record.

The SchedulerControl generates recurring series with occurrences based on the pattern's recurring rule and removes deleted and changed occurrences from the chain. However, if the changed occurrence is moved outside of the queryable time range, it is not loaded and the SchedulerControl will generate an occurrence with the corresponding recurrence index instead of this (non-loaded) changed occurrence. To fix this problem, use the Appointment.OriginalOccurrenceStart and Appointment.OriginalOccurrenceEnd properties in a query instead of the regular Appointment.Start and Appointment.End properties.

The OriginalOccurrenceStart and OriginalOccurrenceEnd properties should be mapped to the corresponding fields in the data source. You can create a new data source which contains these fields or update an existing data source.

Tip

To update an existing data source, perform the following steps:

Expanded See Also

How would you rate this topic?​​​​​​​