Managing many connection strings (ASP.NET 2.0)



Hi all.

I am developing a web application, which should be able to retrieve
data from many databases. In Web.Config I created three named
connection strings.

My app consists of DAL, BLL and Presentation Layer. In GUI user shuld
be able to select database, which he wants to work with. I can store
connection string of selected DB in Session, but I have problems with
passing it to DAL through BLL. My BLL classes are normal cs files and
they do not have access to Session. Of course I can pass this.Page
parameter to BLL and then use page.Session, but I find this solution a
bit clumsy.

Does anybody know a better solution to this? I am sure that many of you
faced the same problem as I do, so I would like to know your solutions.

Thanks in advance,



Teemu Keiski


you could have intermediate class used to represent the session (or
settings), perhaps implementing some interface, which you can pass to BLL .
It's right way to do it, so that BLL etc knows anothing about ASP.NET's
session. It can have session concept but that's loose from the session
implementation of the underlying platform.

I've discussed some of it, in a blog post

ASP.NET's Session and business components


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question