After doing some research,
I don't think we can do anything for Enterprise Library 6.In EntLib 5, there was a central "EnterpriseLibraryContainer" that was used for service location and central configuration parsing. All configuration was fairly implicitly tied to their type registration/IoC mechanism. You'd read configuration, it would parse into IoC registrations, and you'd push those into your container for later use. Lots of service location, etc. going on.
In EntLib 6, they've decoupled all of that. XML configuration no longer ties to IoC at all. Each application block knows about its own configuration (and no other block's); configuration elements internally know how to create the corresponding types. However, they've introduced an alternative mechanism for configuration - programmatic configuration. That's where you'd hook your IoC in.
Using Exception Handling Block as an example...
In EntLib 5 I'd run everything through this "magic" EnterpriseLibraryConfigurator that "knows" how to parse Unity type registrations into Autofac type registrations and when I call "container.Resolve<ExceptionManager>()" then everything would come together. There was no other way to really configure things.
In EntLib 6, it's much more "straight Autofac" as it were. Like, register your policies, register the ExceptionManager type, and call it good.
builder.RegisterType<MyPolicy1>().As<IExceptionPolicyDefintion>();
builder.RegisterType<MyPolicy2>().As<IExceptionPolicyDefinition>();
builder.Registertype<ExceptionManager>();(It's a tiny bit more complicated than that, but you get the idea.)
EntLib 6 does offer a "fluent configuration building" grammar, but what that builds... is System.Configuration.ConfigurationSection objects - the same stuff that gets parsed out of XML.
So the choice for EntLib 6 users is:
- Use XML configuration.
- Use programmatic configuration (building up objects like exception handling policies manually).
- Use programmatic configuration (the fluent grammar that builds, basically, in-memory XML configuration).
- Use the IoC container directly instead of configuration.
What that means for our EnterpriseLibraryConfigurator is... I don't think EntLib 6 has an analog. I don't think we have any work to do.
If we do something, it'd have to be, basically, adapters on a per-block basis (one for Logging Block, one for Validation Block, etc.) that know how to read the respective block's configuration and register things in Autofac accordingly. I'm not sure if that's worth it or even valuable.
I'm thinking we should leave the EntLib 5 bits in there as-is and... that'd be the end of it. Anyone see it differently? Am I missing something?