WCF 4.5 Multi-Layer Services Development with Entity Framework


WCF 4.5 Multi-Layer Services Development with Entity Framework
eBook: $29.99
Formats: PDF, PacktLib, ePub and Mobi formats
$25.49
save 15%!
Print + free eBook + free PacktLib access to the book: $79.98    Print cover: $49.99
$49.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • 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.

Book Details

Language : English
Paperback : 394 pages [ 235mm x 191mm ]
Release Date : December 2012
ISBN : 1849687668
ISBN 13 : 9781849687669
Author(s) : Mike Liu
Topics and Technologies : All Books, Application Development, Enterprise, Microsoft

Table of Contents

Preface
Chapter 1: Web Services and Windows Communication Foundation
Chapter 2: Implementing a Basic HelloWorld WCF Service
Chapter 3: Hosting and Debugging the HelloWorld WCF Service
Chapter 4: Implementing a WCF Service in the Real World
Chapter 5: Adding Database Support and Exception Handling
Chapter 6: LINQ: Language Integrated Query
Chapter 7: LINQ to Entities: Basic Concepts and Features
Chapter 8: LINQ to Entities: Advanced Concepts and Features
Chapter 9: Applying LINQ to Entities to a WCF Service
Chapter 10: Distributed Transaction Support of WCF
Chapter 11: WCF Security
Chapter 12: Extending WCF Services
Index
  • Chapter 1: Web Services and Windows Communication Foundation
    • What is SOA?
    • Web services
      • What is a web service?
      • WSDL
      • Web service proxy
      • SOAP
    • Web services: standards and specifications
      • WS-I Profiles
      • WS-Addressing
      • WS-Security
      • WS-ReliableMessaging
      • WS-Coordination and WS-Transaction
    • Windows Communication Foundation (WCF)
      • What is WCF?
      • Why is WCF used for SOA?
      • WCF architecture
      • Basic WCF concepts – WCF ABCs
        • Address
        • Binding
        • Contract
        • Endpoint
        • Behavior
        • Hosting
        • Channels
        • Metadata
    • WCF production and development environments
    • Summary
    • Chapter 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 the host application
        • Testing the host application
        • IIS Express
        • Modifying the web.config file
        • Starting the host application
      • Creating a client to consume the WCF service
        • Creating the client application project
        • Generating the proxy and configuration files
        • Customizing the client application
        • Running the client application
        • Setting the service application to AutoStart
      • Summary
      • Chapter 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 console application
            • Consuming the service hosted in a console application
          • Hosting the service in a Windows service
          • Hosting the service in the Internet Information Services server using the HTTP protocol
            • Preparing the folders and files
            • Turn on Internet Information Services
            • Creating the IIS application
            • Starting the WCF service in IIS
            • Testing the WCF service hosted in IIS
          • Hosting the service in the Internet Information Services server using the TCP protocol
            • Benefits of hosting a WCF service using the TCP protocol
            • Preparing the folders and files
            • Enabling the non-HTTP WCF activation for the hosting machine
            • Creating the IIS application
            • Testing the WCF service hosted in IIS using the TCP protocol
          • Other WCF service hosting options
        • Debugging the HelloWorld WCF service
          • Debugging from the client application
            • Starting the debugging process
            • Debugging on the client application
            • Stepping into the WCF service
          • Directly debugging the WCF service
            • Starting the WCF service in debugging mode
            • Starting the client application
          • Attaching to a running WCF service process
            • Running the WCF service and client applications in non-debugging mode
            • Debugging the WCF service hosted in IIS
        • Summary
        • Chapter 4: Implementing a WCF Service in the Real World
          • Why layer a service?
          • Creating a new solution and project using WCF templates
            • Creating the WCF service project
          • Creating the service interface layer
            • Creating the service interfaces
            • Creating the data contracts
            • Implementing the service contracts
            • Modifying the app.config file
            • Testing the service using WCF Test Client
            • Testing the service using our own client
          • Adding a business logic layer
            • Adding the business domain object project
            • Adding the business logic project
            • Calling the business logic layer from the service interface layer
            • Testing the WCF service with a business logic layer
          • Summary
          • Chapter 5: Adding Database Support and Exception Handling
            • Adding a data access layer
              • Creating the data access layer project
              • Calling the data access layer from the business logic layer
              • Preparing the database
              • Adding the connection string to the configuration file
              • Querying the database (GetProduct)
              • Testing the GetProduct method
              • Updating the database (UpdateProduct)
            • Adding error handling to the service
              • Adding a fault contract
              • Throwing a fault contract exception
              • Updating the client program to catch the fault exception
              • Testing the fault exception
            • Summary
            • Chapter 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
              • Summary
              • Chapter 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
                  • LINQ to SQL
                • Comparing LINQ to SQL with LINQ to Entities
                • Creating a LINQ to Entities test application
                • Creating the data model
                  • Adding a LINQ to Entities item to the project
                  • Generated LINQ to Entities classes
                • Querying and updating a database table
                  • Querying records
                  • Updating records
                  • Inserting records
                  • Deleting records
                  • Running the program
                • Viewing generated SQL statements
                  • Viewing SQL statements using ToString
                  • Viewing SQL statements using SQL Profiler
                • Deferred execution
                  • Checking deferred execution with SQL Profiler
                  • Deferred execution for singleton methods
                  • Deferred execution for singleton methods within sequence expressions
                • Deferred (lazy) loading versus eager loading
                  • Lazy loading by default
                  • Eager loading with the Include method
                  • Comparing lazy loading and eager loading
                • Joining two tables
                • Querying a view
                • Summary
                • Chapter 8: LINQ to Entities: Advanced Concepts and Features
                  • Calling a stored procedure
                    • Mapping a stored procedure to a new entity class
                      • Modeling a stored procedure
                      • Querying a stored procedure
                    • Mapping a stored procedure to an existing entity class
                  • Inheritance
                    • LINQ to Entities Table per Hierarchy inheritance
                      • Modeling the BaseCustomer and USACustomer entities
                      • Modeling the UKCustomer entity
                      • Generated classes with TPH inheritance
                      • Testing the TPH inheritance
                    • LINQ to Entities Table per Type inheritance
                      • Preparing database tables
                      • Modeling USACustomer1 and UKCustomer1 entities
                      • Generated classes with TPT inheritance
                      • Testing the TPT inheritance
                  • Handling simultaneous (concurrent) updates
                    • Detecting conflicts using a data column
                      • The Concurrency Mode property
                      • Adding another entity data model
                      • Writing the test code
                      • Testing the conflicts
                      • Turning on concurrency control
                    • Detecting conflicts using a version column
                      • Adding a version column
                      • Modeling the Products table with a version column
                      • Writing the test code
                      • Testing the conflicts
                  • Transaction support
                    • Implicit transactions
                    • Explicit transactions
                  • Summary
                  • Chapter 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
                      • Adding a reference to the BDO project
                      • Creating GetProduct in the data access layer
                      • Creating UpdateProduct 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
                      • Creating the test client
                        • Implementing the GetProduct functionality
                        • Implementing the UpdateProduct functionality
                      • Testing the GetProduct and UpdateProduct operations
                      • Testing concurrent update manually
                      • Testing concurrent updates automatically
                    • Summary
                    • Chapter 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
                          • Creating a new WCF service
                          • Calling the new WCF service in the client application
                          • Testing the WCF service with two databases
                      • Enabling distributed transaction support
                        • Enabling transaction flow in service binding
                          • Enabling transaction flow on the service hosting application
                        • Modifying the service operation contract to allow a transaction flow
                        • Modifying the service operation implementation to require a transaction scope
                      • Understanding the distributed transaction support of a WCF service
                      • Testing the distributed transaction support of the WCF service
                        • Configuring the Microsoft Distributed Transaction Coordinator
                        • Configuring the firewall
                        • Propagating a transaction from the client to the WCF service
                          • Testing distributed transaction support with one database
                          • Testing the distributed transaction support with two databases
                      • Tradeoffs of distributed transactions
                      • Summary
                      • Chapter 11: WCF Security
                        • WCF security components
                          • WCF authorization
                          • WCF auditing
                          • WCF transfer security
                            • WCF security modes
                            • WCF transport security
                            • WCF message security
                            • WCF mixed security
                            • WCF transport and message (both) security
                            • Authentication options for transport security
                            • Authentication options for message security
                        • Hosting a WCF service using Basic Authentication
                          • Setting up the service
                          • Enabling the Basic Authentication feature
                          • Configuring Basic Authentication on IIS
                          • Configuring the HTTPS protocol
                          • Configuring Basic Authentication on the service
                          • Testing the service with Basic Authentication
                        • Hosting a WCF service with Windows Authentication
                        • WCF Security Guidance
                        • Summary
                        • Chapter 12: Extending WCF Services
                          • WCF runtime architecture
                          • Why extend WCF services?
                          • WCF extension points
                            • Client-side extension points
                            • Service-side extension points
                          • Extending a WCF service
                            • WCF extension classes
                            • WCF behavior classes
                            • WCF behavior element classes
                            • Applying the extensions
                          • Extending HelloWorldService
                            • Setting up the service
                            • Creating the extension project
                            • Creating an extension class
                            • Creating a behavior class
                            • Creating a behavior element class
                            • Applying the extension to HelloWorldService
                            • Testing the extended HelloWorldService
                          • Summary

                          Mike Liu

                          Mike Liu studied Mathematics and Software Engineering at Nanjing University and Brandeis University, graduated with a bachelor’s degree and a master's degree respectively. He is a Sun Certified Java Programmer (SCJP), Microsoft Certified Solution Developer for Visual Studio 6.0 and Microsoft Certified Solution Developer for .NET. He has been working as a software Engineer/architect on various platforms (DOS, Unix, and Windows) using C/C++, Java, VB/VB.NET, and C#. Mike started using C# for production development back in 2001 when C# was still in beta stage and he is now working as a senior software engineer for an investment management firm in Boston, Mass. Mike had his first book,MITT: Multi-user Integrated Table-processing Tool Under Unix,published in 1993, and a second book,Advanced C# Programming,published in 2003. The previous two versions of this book,WCF Multi-tier Services Development with LINQ and WCF 4.0 Multi-tier Services Development with LINQ to Entities,were published in 2008 and 2010.
                          Sorry, we don't have any reviews for this title yet.

                          Code Downloads

                          Download the code and support files for this book.


                          Submit Errata

                          Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


                          Errata

                          - 1 submitted: last submission 20 Feb 2014

                          Errata type: Typo | Page number: 250

                          "To create the new method, first add the following using statement to the ProductBDOclass:

                          using LINQNorthwindBDO;

                          Then add the following method to the ProductBDOclass:"

                          shoulde be:

                          "To create the new method, first add the following using statement to the ProductDAOclass:

                          using LINQNorthwindBDO;

                          Then add the following method to the ProductDAOclass:"

                          Sample chapters

                          You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                          Frequently bought together

                          WCF 4.5 Multi-Layer Services Development with Entity Framework +    Windows Presentation Foundation 4.5 Cookbook =
                          50% Off
                          the second eBook
                          Price for both: £29.05

                          Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                          What you will learn from this book

                          • Create a WCF service without using the built-in WCF templates so you can understand what’s going on under the hood. Host a WCF service in IIS Express, ASP.NET Development Server, managed applications, IIS, and Windows Service.
                          • Explore and learn different debugging options for a WCF service.
                          • Build a multi-layer real-world WCF service from scratch to understand every layer of a WCF service and apply it to your real work.
                          • Learn basic and advanced concepts and features of Entity Framework, LINQ, and LINQ to Entities.
                          • Apply LINQ to Entities to the data access layer of a WCF service with Self Tracking Entities.
                          • Control concurrent updates to the database with WCF and LINQ to Entities.
                          • Add distributed transaction support to a WCF service.
                          • Understand various security settings of WCF, and host a WCF service with Basic Authentication, SSL, and Windows Authentication.
                          • Explore extension points of WCF and extend a WCF service with custom behaviors.

                           

                          In Detail

                          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.

                          Approach

                          This book is a step-by-step tutorial to guide you through learning WCF and Entity Framework. Clear step-by-step instructions and relevant screenshots will make sure you won't get lost in the new 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.

                          Who this book is for

                          This book is for C#, VB.NET, and C++ developers who are eager to get started with WCF and Entity Framework, and want a book that is practical and rich with examples from the very beginning.

                          Developers and architects evaluating SOA implementation technologies for their company will find this book particularly useful because it gets you started with Microsoft's tools for SOA and shows you how to customize our examples for your prototypes.

                          This book presumes basic knowledge of C# or C++. Previous experience with Visual Studio will be helpful but is not required, as detailed instructions are given throughout the book.

                          Code Download and Errata
                          Packt Anytime, Anywhere
                          Register Books
                          Print Upgrades
                          eBook Downloads
                          Video Support
                          Contact Us
                          Awards Voting Nominations Previous Winners
                          Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                          Resources
                          Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software