Upgrading Microsoft.Practices.ObjectBuilder to Enterprise Library 5.0/Unity 2.0 version

Topics: Enterprise Library Core, General discussion
Nov 27, 2012 at 10:45 AM

I’m working on a project which needs to be upgraded from Enterprise Library 4.0 to Enterprise library 5.0. This project widely uses the namespace Microsoft.Practices.ObjectBuilder. I have learned that in the latest version of EL 5.0 this has been moved to Microsoft.Practices.Unity.ObjectBuilder but I couldn't find most of the classes, interfaces or properties in the latest version of unity 2.0 (to Microsoft.Practices.Unity.ObjectBuilder)
For example IBuilderConfigurator<BuilderStage>, IBuilder<BuilderStage>, ISingletonPolicy, ITypeMappingPolicy, IParameter, .. etc.  These are some missing items in Microsoft.Practices.Unity.ObjectBuilder.
It would be a great help if I get some direction on upgrading the application from Microsoft.Practices.ObjectBuilder  to the Enterprise library 5.0 version of ObjectBuilder.

Nov 28, 2012 at 6:10 AM

The recommended approach would be to use Unity.

Enterprise Library 4 used ObjectBuilder2.  With the release of Enterprise Library 5 ObjectBuilder2 was included as part of the Unity assemblies.  ObjectBuilder2 functionality should still exist in the Microsoft.Practices.ObjectBuilder2 assembly so you should be able to access those classes via that namespace using the Microsoft.Practices.Unity assembly.

Some of the interfaces you mention (e.g. ITypeMappingPolicy) look like they were removed in ObjectBuilder2 which makes me think you are using the original ObjectBuilder (which was used by Enterprise Library 3).  As I mentioned, the recommended approach for new development would be to use Unity.  Another alternative might be to continue using ObjectBuilder.

Randy Levy
Enterprise Library support engineer

Nov 30, 2012 at 8:27 AM

Thanks Randy. That's Helpful. Let me see.