Chapter 17. Using EntityObjects in WCF Services

Services are a critical part of today’s (and tomorrow’s) application environments. You can use entities in service applications, and depending on your needs you can approach the task of using the Entity Framework with services in a number of ways. You can build your own Entity Framework logic into a Windows Communication Foundation (WCF) service, or use a framework that leverages it, such as WCF Data Services or WCF Rich Internet Applications (RIA) Data Services.

Note

It is also possible to use entities in Active Server Method (ASMX) web services, which are still supported in Visual Studio 2010. You can download the ASMX sample created in the first edition of this book from the downloads page of the book’s website. Note, however, that the sample does not benefit from any of the new features of Entity Framework, such as foreign keys or POCO support.

In this chapter, we’ll take a look at all three scenarios. First, you will write a WCF service that makes use of EntityObject-based entities and learn about some of the complications that arise (and their solutions) while you work across the tiers of a distributed application. Even if you don’t plan to write your services with EntityObjects, you will find a lot of useful information in this chapter. We’ll also take a quick look at WCF Data Services and WCF RIA Services in order to get an understanding of how they relate to the Entity Framework.

WCF Data Services and WCF RIA Services are Microsoft’s ...

Get Programming Entity Framework, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.