Dependency Injection in Windows Communication Foundation

Authors: Alex Culp, Robert Dizon, Greg Cowin, and Bill Collette.

Referenced Image

Learn more about RBA Consulting.

RBA is an award-winning, nationally-recognized Microsoft partner offering a full range of application development, portals and collaboration, cloud computing, infrastructure and data management solutions. As one of fewer than 40 Partners awarded the Microsoft National System Integrator designation, RBA has demonstrated its continued commitment to technical competencies, proven ability to deliver solutions and stellar track record of high customer satisfaction. Currently on Inc 500’s List of the country’s fastest-growing private companies, RBA’s entrepreneurial spirit combined with its challenging and rewarding employment experience attracts the industry's top thought leaders and technical talent. For more information, please visit


Dependency Injection (DI) is an object- oriented design pattern for creating loose coupling between classes. This article discusses the benefits of using DI in Windows Communication Foundation (WCF), as well as some techniques for implementing DI in WCF.

In This Section

The Dependency Injection Design Pattern

Examples: Using Unity to Implement DI

Using Instance Provider and ServiceHostFactory to Construct the Service

Using Virtual Methods to Override Behavior