Course Manager Application
The CourseManager sample demonstrates how to bind Windows Forms controls to data returned by the Entity Framework. This application displays and modifies
Course entities associated with
You can bind Windows Forms controls, such as a ComboBox or DataGridView, to the results returned by an instance of the ObjectQuery generic class or EntityCollection generic class. To prevent the query from being executed multiple times during binding, we recommend that you not bind controls directly to ObjectQuery results. Instead, bind controls to the result of the ObjectQuery's Execute method. For more information, see Binding Objects to Controls.
The CourseManager sample creates LINQ to Entities query. It then casts the query to ObjectQuery and calls the Execute method. The result returned from the Exectue method is bound to controls.
LINQ to Entities
Before running this sample, make sure the following software is installed:
Visual Studio 2010 containing the .NET Framework 4
SQL Server 2005 or 2008 Database Engine
School sample database (included in the sample)
SQL Server Management Studio (optional)
- School sample database (included in the sample)
Building the Sample
Use the following procedure to build the sample.
To build the CourseManager sample application
(Optional) If the School sample database is not already present in your SQL Server instance, run the CreateSchool.sql script included with the project.
Open the solution file in Visual Studio.
(Optional) If you created the School database in an instance of SQL Server other than the default instance on the local machine, specify the correct SQL Server instance by modifying the Data Source in the connection string in the App.Config file of the project.
Build the project.
Removing the Sample
Use the following procedure to remove the CourseManager sample.
To remove the CourseManager Data Binding application
Delete the project directory and contents.
(Optional) Drop the CourseManager database from the instance of SQL Server.