ComponentOne Scheduler for WPF and Silverlight
Scheduler Components and Controls / Data-centric Architecture with Silverlight / The Sample Application / Implement the Server Side / Add the Database Access Infrastructure
In This Topic
    Add the Database Access Infrastructure
    In This Topic

    Before implementing the Web services, let's add the database itself to the project. This step is optional. We will use a connection string to specify where the database is located, so we could use any existing copy of the MDB file already in the system. We will create a local copy here to facilitate deployment and to avoid making changes to the original database.

    To add the database to the project, complete the following steps:

    1. Right-click the App_Data node in the Scheduler.Web project and select Add | Existing Item.
    2. In the dialog box, locate the Schedule.MDB file and add it to the project.
    3. In the Properties window, set the Build Action property for the .MDB file to None.

    In addition to the database file, we need a mechanism to transfer data from and to the database. In this sample, we will accomplish this using a utility class called SmartDataSet. SmartDataSet extends the regular ADO.NET DataSet class and adds the following:

    The SmartDataSet is convenient but not necessary. It knows how to create and configure DataAdapter objects used to load and save data, but you could also write standard ADO.NET code to accomplish the same thing. Because it only uses standard ADO.NET techniques, we will not list it here.

    To add the SmartDataSet.cs file to the project, complete the following:

    1. Right-click the Scheduler.Web node in the Solution Explorer and select Add | Existing Item.
    2. In the Add Existing Item dialog box, locate the SmartDataSet.cs file in the C1.Silverlight distribution package and click Add to add it to the project.