As you can probably tell from previous posts, I’m feel pretty mixed about on the Microsoft Patterns & Practices Enterprise Library Data Access Block (MPAPELDAB, for short). I like the design of the classes and I really like that you can access databases other than just SQL Server but I’m having some serious problems with registry and event log access exceptions.
A few days ago, I was trying to access a database using a connection string that I define at run-time. I double dog dare ya to try to figure that one out. Wow. It is not obvious. Far far extra far from obvious. The MPAPELDAB appears to be written with the assumptions that…
- you will always know your database connection strings at deploy time
- they will be in your MPAPELDAB database configuration file
Not bad as assumptions go. I can see how they would make them cuz probably 99% of the time that’s the way it’ll roll.
I found the solution on “Yang’s .NET Zone”. It’s non-trivial. I took the source code, tweeked it a little, and posted my version here. (NOTE: yes, I know you shouldn’t put more than one class or enum per file…I did it so that I only had to post one file instead of 3.)
Leave a Reply