In this step you'll create a new Silverlight project with WCF RIA services enabled, add a data source, and set up the client-side project. Complete the following steps:
1. In Visual Studio 2010, select File | New | Project.
2. In the New Project dialog box, choose Visual C# in the left pane, and in the templates list select Silverlight Application. Enter "C1DataGridRIA" in the Name text box, and click OK. The New Silverlight Application dialog box will appear.
3. In the New Silverlight Application dialog box, check the Enable WCF RIA Services check box and click OK to close the New Silverlight Application dialog box and create your project.
4. In the Solution Explorer, right-click the C1DataGridRIA.Web project and choose Add | New Folder. Rename the folder "App_Data".
5. Right-click the App_Data folder and select Add | Existing Item.
6. In the Add Existing Item dialog box, navigate to where the ComponentOne samples are installed, by default in the Documents or My Documents folder, and navigate to the ComponentOne Samples\Studio for Silverlight 4.0\C1.Silverlight.DataGrid\C1DataGrid_Ria\C1DataGrid_Ria2010Web\App_Data folder. Choose the NORTHWND.MDF file and click the Add button.
The database will be added to your project. Note that this is the standard Microsoft Northwind database.
7. In the Solution Explorer, right-click the C1DataGridRIA.Web project and choose Add | New Item.
8. In the Add New Item dialog box choose Data in the left list and choose ADO.NET Entity Data Model from the list of data templates. Name the file "NorthwindModel" and click Add to add the file to your project.
9. The Entity Data Model Wizard should appear. Choose the Generate from database option and click Next.
10. In the Choose Your Data Connection screen, confirm that the NORTHWND.MDF file is selected. If it is not selected, choose New Connection and locate the file. Save the connection string with the default name, "NORTHWNDEntities", and click Next.
11. In the Choose Your Database Objects screen, select the Tables check box to choose the Products table. Click Finish.
12. Choose Build | Rebuild Solution to build the entire solution and make sure the autogenerated RIA Services files get created.
13. In the Solution Explorer, right-click the C1DataGridRIA.Web project and choose Add | New Item.
14. In the Add New Item dialog box choose Web in the left list and choose Domain Service Class from the list of code templates. Name the file "NorthwindService" and click Add to add the file to your project. The Add New Domain Service Class dialog box will appear.
15. Iin the Add New Domain Service Class dialog box, select NorthwindEntitiesas DataContext item and select the Enable client access check box. Check the Product entity and Enable editing check boxes and click OK.
16. Save the project and choose Build | Rebuild Solution to ensure everything is working correctly.
What You've Accomplished
In this step you added a new RIA data source to your application. In the next step you'll add the C1DataGrid control to the application.