Proper abstraction of the database tier in a 3 tier system?

Posted by Earlz on Stack Overflow See other posts from Stack Overflow or by Earlz
Published on 2010-03-30T16:59:56Z Indexed on 2010/03/30 17:03 UTC
Read the original article Hit count: 247

Filed under:
|
|
|

Hello, I am creating a 3 tier application. Basically it goes

Client -> (through optional server to be a thin-client) -> Business Logic -> Database Layer

And basically making it so that there is never any skipping around. As such, I want for all of the SQL queries and such to be in the Database Layer.

Well, now I'm a bit confused. I made a few static classes to start off the database tier but what should I do for the database connections? Should I just create a new database connection anytime I enter the Database Layer or would that be wasteful? Does Connection.Open() take time whenever you have a ConnectionPool?

To me, it just feels wrong for the Business tier to have to pass in a IdbConnection object to the Database tier. It seems like the Database tier should handle all of that DB-specific code. What do you think? How can I do it the proper way while staying practical?

© Stack Overflow or respective owner

Related posts about c#

Related posts about n-tier