Managing many connection strings (ASP.NET 2.0)

  • Thread starter Thread starter Piotrek
  • Start date Start date
P

Piotrek

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,
Piotrek
 
Hi,

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
http://aspadvice.com/blogs/joteke/archive/2006/04/23/16785.aspx
 
Back
Top