Dependency injection wired to Policy injection

Topics: Building and extending application blocks, Enterprise Library Core, Policy Injection Application Block
Aug 10, 2007 at 9:34 AM
Edited Aug 10, 2007 at 2:54 PM
I think we are missing something very important with the Policy injection: Dependency injection.

I know that we have the object builder that has functionalities to solve dependency but, as I recalled, it was meant for the CAB. Sure it is now the underlying factory in the enterprise library but, I think, AOP and dependency injection should try not to leave footprints in codes. Attributes are nice, but if I could link objects together in the app.config file, that would take the area of possibility to the next level.

Since the InjectionAB is mainly related to an Interface, I find it sad to force the attachment between implementation and interface by having to hardcode the relation Implementation-Interface.

IInjectedInterface = PolicyInjection.Create<InjectedObject, IInjectedInterface>();

I would rather have this:

IInjectedInterface = DependencyInjection.GetService<IInjectedInterface>();

which I would have specified in the app.config files. And the returned Interface would have all the policy injection functionality:)

I know there have been discussions about a dependency injection application block wired with the policy injection. I wander what happen to that. Do the Entlib team plan to develop it?

There is a nice article on that by David Hayden:

Please just tell me if you plan to do it :)