A newer version of this page is available. Switch to the current version.

ResourceDataStorage Class

A storage that holds appointment resources.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v19.2.dll


public class ResourceDataStorage :
Public Class ResourceDataStorage
    Inherits ItemDataStorage(Of Resource)
    Implements IResourceStorage,
               IPersistentObjectStorage(Of Resource),
               IInternalPersistentObjectStorage(Of Resource)

The following members accept/return ResourceDataStorage objects:


Appointments in the XtraScheduler control can be associated with resources. A resource is an object which exposes the Resource interface. It has the following attributes: a unique identifier, caption, color and image.

The XtraScheduler control allows appointments to be grouped by resources. Use the SchedulerControl.GroupType property to specify the required group mode.

The ResourceDataStorage class represents a storage which holds resources. The functionality of the ResourceDataStorage class can be accessed via the SchedulerDataStorage.Resources property. To get the collection of resources use the ResourceDataStorage.Items property.

To associate a resource with an appointment this resource should be added to the ResourceDataStorage object and then bound to the appointment via the Appointment.ResourceId property. It represents a resource ID specified by the IPersistentObject.Id property.

Connecting the ResourceDataStorage object to a data source via the PersistentObjectStorage<T>.DataSource and PersistentObjectStorage<T>.DataMember properties enables bound mode. In this mode, if the PersistentObjectStorage<T>.AutoReload property is set to true resources are automatically retrieved from the specified data source and added to the ResourceDataStorage object, and when data in the data source is modified the ResourceDataStorage object automatically reloads the data. If the AutoReload property is set to false data is not automatically loaded and reloaded from the data source. You should use the SchedulerDataStorage.RefreshData method to reload data manually in this case.

Use the ResourceStorage.Mappings property to specify which fields in the bound data source hold a resource's caption, color and ID. The values of these fields will be synchronized with the corresponding properties of Resource objects.

Appointments for the scheduler control are stored in the AppointmentStorage object. In bound mode, appointments are retrieved from and stored back to a data source specified by the DataSource and DataMember properties of the AppointmentStorage object. This data source may contain a field which holds the resource ID's of appointments. To enable the resource ID's to be automatically retrieved from the database, set the AppointmentMappingInfo.ResourceId property to the name of this field.

In unbound mode (when the ResourceDataStorage object is not bound to a data source) you can use the ResourceStorageBase.Items property to populate the storage with resources manually.


See Also