DI dynamics? (New to EntLib)

Topics: Building and extending application blocks, Enterprise Library Core, General discussion
Mar 12, 2008 at 8:06 AM
Hi, folks,

I am completely new to EntLib (and .NET as well in fact), but I'm familiar with dependency injection. In my previous project, we implemented a DI mechanism on top of the OSGi Module System, and made it work seamlessly across multiple VM's.

OSGi is a very dynamic environment, in which services can appear, disappear and reappear without further notice. The DI mechanism had to handle (re)appearing services by registering listeners in OSGi. Incidentally, our framework also handled the opposite of injection, exposing a service, so that when all your dependencies were satisfied, your own service(s) were exposed, so that they became candidates for injection into other components - and so on. If your dependencies were lost later (e.g. if a machine went down), your service might get unexposed, which might take away a dependency for someone else - and so on. In short, in this environment, the work of the DI framework is never done.

Before that, I used the Spring framework. Spring was, at least back then, static in comparison - the basic usage pattern was to have Spring wire everything up as configured, and then start up. It did not have much in the way of a runtime API, or dynamic "uninjection" of services. This works well for webapps and tiered applications with well-known dependency structures.

So when getting to grips with EntLib, my approach is to find out where it lies in relation to these two extremes. We are making a system that might be very dynamic - in fact, we're porting the OSGi-based one I'm referring to - how would EntLib fit with that? Which elements of the EntLib design have more or less of that degree of dynamic freedom between them? Should I be using something else? (We may not have all the freedom we would like wrt. third-party/open-source libraries on the project.)

Thanks for everybody's time,

Kjetil (yes, I am reading up on the code base, too, but I find it is often worthwhile to get those larger questions out there as well)

Mar 14, 2008 at 1:57 AM
Edited Mar 14, 2008 at 1:58 AM
The unfortunate truth of Entlib 1-3 is that they are not really designed for DI environments. They work if you do the setup but they rely heavily on their configurations sections to start and work. EntLib 4.0 will be based on DI and use Unity (MS P&P's DI Container) as a base which will make it more modular like you're after. If someone on the EntLib team sees this they may be able to give you and estimated CTP date.
Mar 14, 2008 at 6:54 AM

dpiessens wrote:
EntLib 4.0 will be based on DI and use Unity (MS P&P's DI Container) as a base which will make it more modular like you're after.

Thanks for replying. I should have pointed out that I was asking about EntLib 4.0, with Unity. Maybe I should trot on over to their forums :-)