Home > .net 2.0, c#, Visual Studio 2005 > ConnectionString settings in Enterprise Library DAL

ConnectionString settings in Enterprise Library DAL

April 18, 2007

Here’s an instance of trying to make things TOO DIFFICULT for myself.

I’m creating a DAL framework for our common application functions–authentication, student/staff/class lookups, etc.–to save a bit of redundancy in development in the organization and was boggled around one error:

DatabaseFactory.CreateDatabase(“{instance_name}”); threw an odd error that it couldn’t find the connection settings.

I did what I thought I should do–adding a ConnectionSettings.config file to the class library–but that was to no avail.

Why?

Because, it appears you can’t couple a .config file with the library; it has to be a function of the “using” application (in my case, it was a console app I created to test the .dll with).  Adding an App.config with the approprate DAAB structure worked just fine.

So, to those out there–is there a way to tie those config files directly to the .dll?  I’m sure that’s overkill and unneeded, but it’d be kinda cool to keep those things outside the App.config or Web.config files.🙂

 

  1. Jake
    November 11, 2008 at 4:19 pm

    Hi! I know you wrote this awhile, but with Google, everything is new!🙂
    Anyway, I just stumbled upon this exact issue today with Enterprise Library 4.1. I really hate putting connection strings at the user level. Did you ever come across a solution for this?

    Thanks!
    Jake

  2. November 12, 2008 at 8:46 am

    @Jake-

    Honestly, no, I never found a good solution and ended up writing my own controller classes and skipping Enterprise Library. =/

  3. An Phu
  1. No trackbacks yet.
Comments are closed.
%d bloggers like this: