Converting the Composite Web Application Block to Unity - Intro

A few weeks ago, I decided I needed to play with the Unity Dependency Injection container. I wanted to see how Chris and the rest of the team had designed it and see how usable the container was. I had seen requests on the Web Client Software Factory project's CodePlex site asking for a Unity version of WCSF. Put the two together, and I have a side project, a proof of concept I can legitimately do at work. My eventual end goal is to have the Order Management RI working with a new, Unity-based version of CWAB.

So, I sat down a few Saturdays ago, with CWAB, an early drop of Unity, and started working. After about eight hours I had the basics of CWAB working: there was a container, and a module loader, global services, and module level services. About 3 hours was used figuring out Unity, the differences between it and the container we created for CWAB (CompositionContainer) , and how to get around them. The rest was work, finding bugs in Unity (I filed a few the next day), and quite a lot of fun.

Since then, I have added a few more features, made some forwards progress, and lost ground after being overly optimistic about the impact of a few changes.

Now that I have learned a bit, I wanted to share the information with folks who might be interested in doing this themselves. Rather than trying to remember what I did the first time around, I am going to start over, take a different approach, document what I do as I go, and make a few posts out of this.

Please keep in mind, none of this is tested.  Use at your own risk.  No Support Available.  Danger, Will Robinson!  Danger!

This is a proof of concept that I am fairly certain will work, but I am not 100% certain. We will find out as we go. Oh, and I guarantee that there will be breaking changes.

My strategy will be to take the existing CWAB DLL and its unit tests, refactor the container behind an interface, modify the interface to nearly match Unity, and then drop Unity in replacing one implementation of the interface with another. After I get CWAB building and the unit tests passing with Unity, I will open up the code for the RI, replace references, and get it to work.

I will do all of this in an example-driven test driven manner. I am sure I will cheat on occasion, but I will try to be honest and point it out when I do, as well as a reason why.

EDIT: Based upon feedback, I am making the source code available at CWAB and Unity.

Comments

  • Anonymous
    April 04, 2008
    This is the second post in a series. The initial post is Converting the Composite Web Application Block

  • Anonymous
    April 06, 2008
    Mike Puleio recently posted blog entries on how to convert Composite Web Application Block (CWAB) to

  • Anonymous
    April 06, 2008
    Michael Puleio is writing a series of articles on converting the CWAB in WCSF to Unity. I have a Simple Web Application Block that...

  • Anonymous
    April 07, 2008
    I will waiting for your code, I think is amazing, I think it will be more ligth, elegant and decouple version of WCSF that are amazing too.   I´m leader of community from Guatemala, and I´m planning present unity proyect and Will be nice If I can do with your WCSF verion.   So my best wishes to you, in this amazing journey and expirence you already have.

  • Anonymous
    April 08, 2008
    No es un generador de código, no amigos...para nada. Una Software Factory es mucho mas que eso y es necesario

  • Anonymous
    April 09, 2008
    This is the third post in a series. The other post include Converting the Composite Web Application Block

  • Anonymous
    April 22, 2008
    This is the third post in a series. The other post include Converting the Composite Web Application Block

  • Anonymous
    April 25, 2008
    El pasado 4 de Abril del 2008, fue liberada la versión de producción del proyecto Unity. Este es un IoC

  • Anonymous
    May 01, 2008
    This is the fifth post in a series. The other post include: Converting the Composite Web Application

  • Anonymous
    May 21, 2008
    This is the sixth post in a series. The other post include: Converting the Composite Web Application