WCF using ADO.NET Entity Framework
In this recipe, let's use the SQL Server database as the backend. We will create the MyTask
table in the SQL Server Express database.
Getting ready
For this recipe, let's create a WCF service project similar to the last recipe. Let's call this project Recipe3_WCFSQLService
.
How to do it...
In this recipe, we will create the WCF Service project with SQL Server as the backend database. We use the ADO.NET Entity Framework to create all the entity objects, and then we add the methods to return the results to the client application.
In this recipe, we will add SQL Server Express database to the project. Name it
MyTasks.mdf
.Double-click the database to open it and then right-click on Tables to add a new table. Call this table
MyTask
and add the columns as shown in the following screenshot:After the table is created, add a couple of test records using insert statements; or you can directly enter them in the result grid.
Now using the graphical view build a query by...