DCSIMG
Unity Application Block - Gil Fink's Blog

Gil Fink's Blog

Fink about IT

News

Microsoft MVP

My Facebook Profile My Twitter Profile My Linkedin Profile

Locations of visitors to this page

Creative Commons License

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.
© Copyright 2012 Gil Fink

Hebrew Articles

Index Pages

My OSS Projects

English Articles

Unity Application Block

Unity Application Block

A new release of enterprise library was published few weeks ago.Patterns & Practices
In the new release the ObjectBuilder subsystem was replaced with
the new Unity application block. In this post I’ll describe what is the
Unity application block and when to use it.

What Is The Unity Application Block?
The Unity application block is described as a lightweight,
extensible dependency injection container. Unity enables
constructors, properties or method calls injections.
The main reason to use Unity is to design and build loosely coupled
applications. By doing so the application will be more flexible and
maintainable. Dependency injection is a technique for building a
loosely coupled applications. It decouples the dependencies between
objects and abstract their connections. For example a scenario of a 
person class that use a validation object which validate it’s properties
and a data access object which holds the person’s database operations. 
The dependency injection techniques help to the person class to 
instantiate and populate those objects and also help to decouple those
objects from the person class.

Advantages Of Using Unity

  • Simplifies object creation.
  • Abstraction of requirements – dependencies are specified
    in runtime or by configurations.
  • Increased flexibility by deferring component configuration to the
    container.
  • Service location capability – clients can store or cache the
    dependencies container.

When To Use Unity?

  • You have dependencies between objects.
  • The dependencies are complex and you need a way to abstract
    them.
  • You want to be able to change your dependencies at runtime.
  • You want to be able to persist your dependencies in web
    applications.
  • You want to use constructors, properties or method calls injections.

Summary
In this post I explained what is the Unity application block,
why to use it and when to use it. In the next posts in this subject I’ll explain
how to use Unity in more details.

Comments

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# June 9, 2008 9:45 AM

Guy Burstein on MSDN said:

Unity Application Block Resources – by Gil Fink Gil Fink has done a lot of work around the Unity Application

# July 25, 2008 2:29 PM