Working with WCF Data Services and Entity Framework
In this section, we will discuss how we can create a WCF Data Service using Entity Framework and the AdventureWorks
database. To add a WCF Data Service application to an existing web application, follow these steps:
Create an ASP.NET application:
Create a new Entity Data Model and name it
AdventureWorks
:Select Code First from database:
In the Entity Data Model Wizard dialog, specify the data connection properties and click Next:
Next, choose the database objects you want to be part of the Entity Data Model:
Now, right-click on the project in the solution explorer window and select Add New Item.
Select WCF Data Service from the list of the templates displayed, specify a name, and click OK.
And, you are done! At first glance, the WCF Data Service class looks like this:
using System.Data.Services; using System.Data.Services.Common; namespace WCFDataServices { public class CurrencyDataService : DataService< /* TODO: put your data source...