Move Dependency Injection from WCSF to Enterprise Library

Move Dependency Injection from WCSF to Enterprise Library

David Hayden ( Florida .NET Developer ), Filed: Web Client Software Factory, Enterprise Library

 

One of the features of the Web Client Software Factory ( and Smart Client Software Factory ) is that it helps you with Dependency Injection using the concepts of Composition Containers:

 

Web Client Software Factory Dependency Injection

 

I appreciate the team adding the functionality as I find it beneficial and I have learned a lot from it. However, I have a couple of concerns:

  1. This functionality should really be provided by Enterprise Library.
  2. The current solution in WCSF is a bit over-complicated.

Dependency injection is not a client-related technology, but a service that is applicable across all applications just like database access, logging, exception handling, validation, etc. Obviously the WCSF Team had to jump in and provide functionality where it was missing in Enterprise Library, but hopefully the Enterprise Library Team will create a Dependency Injection Application Block so we don't have to deal with all these independent containers that need to built.

In case Grigori ( Enterprise Library Product Manager ) is reading this post :), I did mention the need for a Dependency Injection Application Block in the Planning the next release of Enterprise Library Survey.

I also think the current Dependency Injection solution in WCSF ( and SCSF ) is a bit overly complicated by requiring several attributes that are tied to the creation method of the object:

  • [CreateNew] - When you want to create the object from scratch
  • [ServiceDependency] - When you want a singleton from the Services Collection
  • [ServiceInterfaceDependency] - Extension for when you want to create an object based on Type Mapping

I talk about dependency injection in WCSF more in the following screencast:

Specifying creation methods and lifestyles with the attributes feels a little overly complicated to me. A simple [Dependency] attribute should be enough for properties. In some cases, like in constructors, we should not need to specify attributes at all.

The point, however, is that this isn't a Web Client Software Factory problem. This is an Enterprise Library problem and I hope the Enterprise Library Team steps up to the plate on this unless they have cooler things in mind :) I look forward to Grigori posting some initial results from the survey we all voted on :)

 

Source: David Hayden ( Florida .NET Developer ), Filed: Web Client Software Factory, Enterprise Library

posted on Saturday, September 22, 2007 6:40 PM

My Links

Post Categories

Article Categories

Archives

Loose-Leaf Tea