Data Access Layer in ASP.Net: Where do I create the Connection?

Posted by atticae on Stack Overflow See other posts from Stack Overflow or by atticae
Published on 2010-12-31T17:34:47Z Indexed on 2010/12/31 17:54 UTC
Read the original article Hit count: 257

Filed under:
|
|
|

If I want to create a 3-Layer ASP.Net application (Presentation Layer, Business Layer, Data Access Layer), where is the best place to create the Connection objects?

So far I used a helper class in my Presentation Layer to create an IDbCommand from the ConnectionString in the web.config on each page and passed it on to the DAL classes/methods.

Now I am not so sure, if this part shouldn't also be included in the DAL somehow, because it obviously is part of the Data Access. The DAL is in a separately compilated project, so I dont have access to the web.config and cannot access the connection string (right?).

What is the best practice here?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET