- 4 minutes to read
This topic presents an overview of the scheduler's control model. It is intended to gain some insight into which objects pertain to which layers in the suite.
Internally, the Scheduler makes use of a set of layers to logically separate functionality. There are three logical layers: the datalayer, the storage layer, and the control layer. Before an object, such as an appointment, is displayed within the Scheduler display area, it has to make its way through all these layers. At each layer, it gets transformed or wrapped into another object with its own specific attributes for that layer. These modifications are necessary, in particular in the case of recurring appointments, because their quantity, and the object hierarchy used do not correspond to the information contained within the data source records.
The data layer contains a data source. Any object that implements the IList interface may become a data source for the Scheduler. Some of these objects are listed below:
- Simple objects, such as lists, arrays, or collections. It could be a list of user-defined classes, representing the Appointment business object.
- ADO .NET data objects - DataSet, DataTable with DataRow, DataView.
- XPO object collection
The layer contains data objects from the application's namespace.
When you use a Scheduler in its SchedulerControl.UnboundMode mode, this layer is hidden from you. Appointment data manipulation (fetching, writing back, inserting, and deleting) is accomplished via an inner storage implementation.
The storage layer stores collections of PersistentObjects. A PersistentObject is a proxy object automatically created for a business object when it is loaded from the data source. A PersistentObject has an internal property that serves to maintain a link (a row handle, if you will) to the data source in the data layer.
Notice that you shouldn't mistake this layer for any storage mechanism you may have in the data layer. The storage layer here is temporary storage for the Scheduler itself.
The control layer contains the visual representations of the persistent objects from the previous layer. These visual objects are generated from the storage layer's data. The contents of the control layer are determined by the displayed time interval, the SchedulerControl.ActiveView, the control properties, and event handlers.
The appointments and resources collections in this layer include objects which have passed multiple filters on their way from the database, as well as objects that are newly created as the result of end-user actions (such as in-place editing, drag-n-drop, and so on).
The layer contains the following objects:
- collections of appointments (AppointmentViewInfoCollection)
- collections of resource containers (resource headers, day view columns, single weeks, timelines)
They belong to the DevExpress.XtraScheduler.Drawing namespace.
The following picture summarizes the layer interactions within XtraScheduler:
Data Layer - Storage Layer
A simple mapping technique is used for establishing the communication between the data and storage layers. The mapping describes how the PersistentObject's properties contained within the storage layer correspond to the data fields at the data layer.
In unbound mode, the data layer is hidden, and the property mapping is undefined.
The storage layer establishes a two-way communication with data source objects, which means that any addition or modification to storage objects results in the equivalent actions being performed on the data layer objects, and vice versa.
Storage Layer - Control Layer
The control layer interacts only with the storage layer objects. It has no direct contact with the data layer objects.
The addition, modification, or deletion of control layer objects results in the corresponding changes being applied to the storage objects, and vice versa.
The Storage layer has an appointment cache, populated with appointments that satisfy the currently displayed visible interval. This is the part of the working area of the Scheduler control visible to the end-user. When the Scheduler control changes its view and the visible interval is not modified, the control fetches the appointments from the cache, helping to optimize the query route and reducing the time to refresh the display area.
It is worth mentioning here that the Date Navigator also has its own appointment cache, which is used to highlight dates with appointments. This cache is different from the one we just described for the storage layer, and has no connection with it.