Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

ObjectBuilder

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

ObjectBuilder is a framework for creating dependency injection systems, largely used in the Web Client Software Factory and in related projects such as Enterprise Library.

A Composite Web Application Block application consists of loosely coupled components. The components, though independent, collaborate during the execution of a web client solution. To support component independence, a component must be able to use another component without requiring a change to the source code of the component to be used. To support this, the Composite Web Application Block uses dependency injection to create component object instances. When you examine the source code for a Composite Web Application Block application, you will notice that the application does not create instances of another component by directly constructing an object (using new). Instead, the source code for a Composite Web Application Block application contains attributes such as CreateNew and ServiceDependency.

These attributes support the injection of objects at run time. The Composite Web Application Block uses ObjectBuilder to create and inject instances of objects of the appropriate type into the application at run time. ObjectBuilder uses the factory pattern to create object instances. It supports a general-purpose attribute-based dependency injection. The attributes determine the type of object that the ObjectBuilder factory creates.

Ff650438.note(en-us,PandP.10).gifNote:
ObjectBuilder itself is not a dependency injection system; it is a more general purpose and extensible pipeline that allows you to customize how an object is created.

ObjectBuilder is a low-level utility that, in most cases, you will not directly interact with in your applications. The classes in the application blocks use it to generate object instances when your code creates the classes declared in the application blocks. However, you can use the features of ObjectBuilder directly in your applications and your own frameworks if you want. You can also influence the behavior of ObjectBuilder by creating your own strategies or modifying the existing strategies.

Ff650438.note(en-us,PandP.10).gifNote:
ObjectBuilder is a patterns & practices application block, but because of its highly specific audience and its recent inception, it is not yet fully documented as a stand-alone asset like the Enterprise Library application blocks are.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.