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
     Pop-up Menus
    [Collapse]Data Binding
     [Collapse]Data Sources
       Microsoft Access Database
       Microsoft SQL Server
       Business Objects
       Entity Framework
       Entity Framework Code First
       eXpress Persistent Objects (XPO)
       XML Data
       Hierarchical Resource Specifics
       Gantt View Specifics
      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]ASP.NET Core 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]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Entity Framework Code First

A Scheduler Storage can be bound to a data source created using the Entity Framework Code First approach. The following code demonstrates how to implement appointment and resource objects.

Expanded Appointments

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E4107.

Expanded Resources

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E4107.

Expanded DbContext

The DbContext class descendant is required to retrieve data from the database. It is implemented as follows:

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E4107.

Expanded Mappings

Before binding to a data source we have to map data fields to appointment and resource properties. The code that creates the required mappings is shown below.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E4107.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E4107.

Expanded Database Initialization

Handle the Form.Load event to create the database, fill it with initial data and specify appointment and resource binding sources.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E4107.

Not the use of the System.Data.Entity.DbExtensions.ToBindingList<T> method as the source for data binding.

Expanded Database Commit

The SaveChanges method of DbContext descendant - the SchedulerContext object - is used to commit changes to the data source. Subscribe to the SchedulerStorageBase.AppointmentsInserted, SchedulerStorageBase.AppointmentsChanged and the SchedulerStorageBase.AppointmentsDeleted events to save the SchedulerContext object.

To exclude the identity field from the fields being committed to the data source, set the AppointmentStorage.CommitIdToDataSource property to false.

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