# Table Definitions and Relationships

The database diagram is very common to the class diagram of the RadScheduleView interfaces:

![radscheduleview populating with data schedule View Data Base Diagram](https://www.telerik.com/products/wpf/documentation/assets/b59729808e276d314691e6c23315ca82/radscheduleview_populating_with_data_scheduleviewdatabasediagram.png)

## Table Definitions

We have table definitions in the database according for the following types in the RadScheduleView:

| Class Diagram                                                                                                                                                                                                                                                                                                                                                                                                                                                              | Table Definition                                                                                                                                                                                                                                           |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| IAppointment & IExtendedAppointment<br/>![radscheduleview populating with data IAppointment](https://www.telerik.com/products/wpf/documentation/assets/252267cac229fde2de61ad69cf3cf1e8/radscheduleview_populating_with_data_iappointment.png)<br/>![radscheduleview populating with data IExtended Appointment](https://www.telerik.com/products/wpf/documentation/assets/9a6196223f342d86febb8f0f8a4ce9b3/radscheduleview_populating_with_data_iextendedappointment.png) | SqlAppointments<br/>![radscheduleview populating with data Sql Appointments](https://www.telerik.com/products/wpf/documentation/assets/9d600c33542d2226eb76ed8bd128cc8a/radscheduleview_populating_with_data_sqlappointments.png)                          |
| IResource<br/>![radscheduleview populating with data IResource](https://www.telerik.com/products/wpf/documentation/assets/a35e5c31bb325846ce5f9f2bbf42bfe5/radscheduleview_populating_with_data_iresource.png)                                                                                                                                                                                                                                                             | SqlResources<br/>![radscheduleview populating with data Sql Resources](https://www.telerik.com/products/wpf/documentation/assets/d5a13c22a769f169b5f72be2360189d1/radscheduleview_populating_with_data_sqlresources.png)                                   |
| IExceptionOccurrence<br/>![radscheduleview populating with data IException Occurence](https://www.telerik.com/products/wpf/documentation/assets/98c70633d69326d9193e18a2238fbd1b/radscheduleview_populating_with_data_iexceptionoccurence.png)                                                                                                                                                                                                                             | SqlExceptionOccurrences<br/>![radscheduleview populating with data Sql Exception Occurrences](https://www.telerik.com/products/wpf/documentation/assets/aca558a1c23ddbb31dcb45238929faa2/radscheduleview_populating_with_data_sqlexceptionoccurrences.png) |
| IResourceType<br/>![radscheduleview populating with data IResource Type](https://www.telerik.com/products/wpf/documentation/assets/9c4c7881d10fa13343fc0a02bb28c1d5/radscheduleview_populating_with_data_iresourcetype.png)                                                                                                                                                                                                                                                | SqlResourceTypes<br/>![radscheduleview populating with data Sql Resource Types](https://www.telerik.com/products/wpf/documentation/assets/74eeef33e89f8da83b17960b6991676b/radscheduleview_populating_with_data_sqlresourcetypes.png)                      |
| ICategory<br/>![radscheduleview populating with data ICategory](https://www.telerik.com/products/wpf/documentation/assets/0e5b2a51d2b0795a73dd333f649ab879/radscheduleview_populating_with_data_icategory.png)                                                                                                                                                                                                                                                             | Categories<br/>![radscheduleview populating with data Categories](https://www.telerik.com/products/wpf/documentation/assets/70d8434e1b94c63e265727086b292c9a/radscheduleview_populating_with_data_categories.png)                                          |
| ITimeMarker<br/>![radscheduleview populating with data ITime Marker](https://www.telerik.com/products/wpf/documentation/assets/51613a8d3be2b8bbf99e254ac747f803/radscheduleview_populating_with_data_itimemarker.png)                                                                                                                                                                                                                                                      | TimeMarkers<br/>![radscheduleview populating with data Time Markers](https://www.telerik.com/products/wpf/documentation/assets/5d0e713a32c9fb7e208b7b58ea006c4c/radscheduleview_populating_with_data_timemarkers.png)                                      |

## Relationships

Here are some explanations about the keys and the relationships in the data tables:

| Name                                                | Between                                            | Type        | Update/delete rule |
| --------------------------------------------------- | -------------------------------------------------- | ----------- | ------------------ |
| FK_SqlResources_SqlResourceTypes                    | SqlResourceTypes - SqlResources                    | One-to-many | No Action          |
| FK_SqlAppointmentResources_SqlResource              | SqlResources - SqlAppointmentResources             | One-to-many | Cascade            |
| FK_SqlExceptionResources_SqlResource                | SqlResources - SqlExceptionResources               | One-to-many | Cascade            |
| FK_SqlExceptionOccurrences_SqlAppointments          | SqlAppointments - SqlExceptionOccurrences          | One-to-many | Cascade            |
| FK_SqlExceptionAppointments_SqlExceptionOccurrences | SqlExceptionOccurrences - SqlExceptionAppointments | One-to-many | Cascade            |

* There is no table definition for the **IRecurrenceRule** type because we don’t need it. Storing the **RecurrencePattern** is enough to generate the recurrence rules at run-time.
* We cannot save the Brush type into the database directly, that’s why we can save a string that represents the color and convert the string to **SolidColerBrush** object when the TimeMarkers & Categories are loaded.
* The **SqlAppointmentResource** and **SqlExceptionResources** are cross-tables between:
  * SqlAppointments & SqlResources
  * SqlExceptionAppointments & SqlResources
