At the end of Enterprise LIbrary v1, we knew .NET 2 was coming and that there would need to be changes to configuration. The biggest thing I heard (from Brad, Peter, Jim, Brian etc) was that the blocks should be completely independent from configuration. At the same time we were really talking about Dependency Injection and how we could accomplish removing configuration with this mechanism (at the same time figuring out .NET 2.0 config and the changes we wanted for EntLib V2).
While we were working on EntLib V2, we were working in the same room as the Composite Application Block team where Brad, Peter and Ed come up with ObjectBuilder. We decided we would use ObjectBuilder as the DI framework and and build our own container (EnterpriseLibraryFactory). By doing this we could inject config into the blocks given an IConfigurationSource. Given all the learnings, changes, etc, I don't feel we made it to the finish line when breaking out configuration. I think to really get to the solution we needed to remove the dependency of the Common library from all the other code. Enter EntLib V3.
Enterprise Library version 3 is another great release, yet I am sad that the configuration did not get much attention (of course that is probably because I had written it 12 times before). Now that we have the EntLibContrib project on CodePlex I thought I would start putting up the code that I have migrated to not use config. You can find it there in the EntLibRefactored folder of the project. I have my own solution so I can refactor more as I go along. All the original EntLib assemblies are in the 3rd party directories so you don't have to install it. Eventually, they will not be necessary. Wouldn't this be a cool way to run EntLib 4?
Why am I doing this?
Good question. Developing a product and using it are two different things. We use ObjectBuilder and EntLib V2 for the CodePlex site. What we wanted was the new PIAB (Process Invocation Application Block) for the interception mechanism. Looking at the block, I discovered that to use it we needed to drag along the Common and ObjectBuilder library. I didn't mine ObjectBuilder but taking Common was out of the question... we were still using EntLib V2. If I didn't have a dependency on the Common library, I could use ObjectBuilder and PIAB since they were the same.
This is the major reason that I decided that it was time to start this process of removing the dependency of configuration from the blocks. My first stab was to rewrite PIAB using the EntLib V3 binaries... and I have to say it was pretty easy. You could take the same approach (and I will eventually) with the rest of the library.
What is next?
I have a few more things I want to do while removing the configuration. If you think about removing the configuration from PIAB, you could move it further down the stack. You could then build a container that did both DI and AOP. This is what we are doing for CodePlex. Watch here for updates. Brad and I should have some new code for you that includes just this!
Technorati Tags: Enterprise Library, ObjectBuilder