If you’re looking for a practical, user-friendly guide to WCF and Entity Framework, here it is – a step-by-step tutorial that focuses on the essentials of building SOA applications on Microsoft to get you started straight away.
- This book will teach you WCF, Entity Framework, LINQ, and LINQ to Entities quickly and easily.
- Apply best practices to your WCF services and utilize Entity Framework in your WCF services.
- Practical, with step-by-step instructions and precise screenshots, this is a truly hands-on book for all C++, C#, and VB.NET developers.
WCF is Microsoft's recommended model for building services and Entity Framework is Microsoft’s preferred ORM for accessing underlying data storages. Learning WCF and Entity Framework has become essential and critical for every software developer to survive in this SOA world.
WCF and Entity Framework are two powerful yet complex technologies, and there are huge reference tomes out there in the market for these two technologies. With this book, you won’t get overwhelmed or scared away by tons of references; instead, you will be given a simple, easy-to-follow approach to get started. For the code solutions within this book, unlike many other WCF and EF books, where you have just one code snippet after another code snippet, all solutions in this book are fully working and completely finished. These solutions are independent of each other, yet built on top of each other, and get more and more sophisticated as the book progresses, so you can learn more advanced WCF and EF techniques easily and quickly.
This book is a step-by-step tutorial to guide you through learning WCF, Entity Framework, LINQ, and LINQ to Entities. You will be guided to create six WCF and Entity Framework solutions from scratch, of which three are multi-layered real-world WCF service solutions, so you will not only be reading, but also be coding through the book, to gain practical experience of WCF and Entity Framework.
Various test clients will be associated with each solution and all solutions can be built and run independently of other solutions. Clear instructions and relevant screenshots will make sure you won't get lost in the world of WCF and Entity Framework. Configuration files, host applications, test clients, and WCF services for each solution will also be available for download for you to examine, modify, and debug from the outside in.
The book focuses on the essentials of using WCF and Entity Framework, rather than providing a reference to every single possibility. It leaves the reference material online where it belongs, and concentrates instead on practical examples, code, and advice.
Table of Contents
WCF 4.5 Multi-Layer Services Development with Entity Framework
- Table of Contents
- WCF 4.5 Multi-Layer Services Development with Entity Framework
- About the Author
- About the Reviewers
1. Web Services and Windows Communication Foundation
- What is SOA?
- Web services
- Web services: standards and specifications
Windows Communication Foundation (WCF)
- What is WCF?
- Why is WCF used for SOA?
- WCF architecture
- Basic WCF concepts – WCF ABCs
- WCF production and development environments
2. Implementing a Basic HelloWorld WCF Service
- Creating the HelloWorld solution and project
- Creating the HelloWorldService service contract interface
- Implementing the HelloWorldService service contract
- Hosting the WCF service in IIS Express
- Creating a client to consume the WCF service
3. Hosting and Debugging the HelloWorld WCF Service
Hosting the HelloWorld WCF service
- Hosting the service in ASP.NET Development Server
- Hosting the service in a managed application
- Hosting the service in a Windows service
- Hosting the service in the Internet Information Services server using the HTTP protocol
- Hosting the service in the Internet Information Services server using the TCP protocol
- Other WCF service hosting options
Debugging the HelloWorld WCF service
- Debugging from the client application
- Directly debugging the WCF service
- Attaching to a running WCF service process
- Hosting the HelloWorld WCF service
4. Implementing a WCF Service in the Real World
- Why layer a service?
- Creating a new solution and project using WCF templates
- Creating the service interface layer
- Adding a business logic layer
5. Adding Database Support and Exception Handling
- Adding a data access layer
- Adding error handling to the service
6. LINQ: Language Integrated Query
- What is LINQ?
- Creating the test solution and project
- Datatype var
- Automatic properties
- Object initializer
- Collection initializer
- Anonymous types
- Extension methods
- Lambda expressions
- Built-in LINQ extension methods and method syntax
- LINQ query syntax and query expression
- Built-in LINQ operators
7. LINQ to Entities: Basic Concepts and Features
- ORM: Object-Relational Mapping
- Entity Framework
- LINQ to Entities
- Comparing LINQ to Entities with LINQ to Objects
- Comparing LINQ to SQL with LINQ to Entities
- Creating a LINQ to Entities test application
- Creating the data model
- Querying and updating a database table
- Viewing generated SQL statements
- Deferred execution
- Deferred (lazy) loading versus eager loading
- Joining two tables
- Querying a view
8. LINQ to Entities: Advanced Concepts and Features
- Calling a stored procedure
- LINQ to Entities Table per Hierarchy inheritance
- LINQ to Entities Table per Type inheritance
Handling simultaneous (concurrent) updates
- Detecting conflicts using a data column
- Detecting conflicts using a version column
- Transaction support
9. Applying LINQ to Entities to a WCF Service
- Creating the LINQNorthwind solution
- Modeling the Northwind database
- Creating the business domain object project
- Using LINQ to Entities in the data access layer
- Creating the business logic layer
- Creating the service interface layer
- Testing the service with the WCF Test Client
- Testing concurrency with our own client
10. Distributed Transaction Support of WCF
- Creating the DistNorthwind solution
- Hosting the WCF service in IIS
Testing the transaction behavior of the WCF service
- Creating a client to call the WCF service sequentially
- Testing the sequential calls to the WCF service
- Wrapping the WCF service calls in one transaction scope
- Testing multiple database support of the WCF service
- Enabling distributed transaction support
- Understanding the distributed transaction support of a WCF service
- Testing the distributed transaction support of the WCF service
- Tradeoffs of distributed transactions
11. WCF Security
- WCF security components
- Hosting a WCF service using Basic Authentication
- Hosting a WCF service with Windows Authentication
- WCF Security Guidance
12. Extending WCF Services
- WCF runtime architecture
- Why extend WCF services?
- WCF extension points
- Extending a WCF service
- Extending HelloWorldService
- Title: WCF 4.5 Multi-Layer Services Development with Entity Framework
- Release date: December 2012
- Publisher(s): Packt Publishing
- ISBN: 9781849687669