Hello and Happy New Year 2009 !

Here is a sample code I wrote to show you how to create a WCF Web service which is using Entity Framework to access a SQL 2008 database.

Here are the main steps:

1 - create your SQL database (Products) with the 3 tables : Product, ProductInventory and Location. See the tables here.

2 - create a WCF Web service (ProductsService) with one method: List<Products> GetProducts()

3 - create a class library (DataLibrary) with the ProductsModel (the Entity Model for the 3 tables) and one class : ProductManager (which has the context and the business logic)

4 - in the Web service method call the ProductManager method to obtain the list of products

5 - copy the connexion string from the DataLibrary to the Web service's config file

6 - create a WPF client, add a reference to the Web service and bind the list of products to a listbox

And this is it. See the running program here. The source code is in the attached zip file (Visual Studio 2008).