Re: How to do non dependence on database vendor?
- From: "Bjorn Abelli" <bjorn_abelli@xxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 15 May 2005 01:01:31 +0200
"Brett" wrote...
> If I want to easily swap the database I'm using, what is
> the best method for developing that tier in my application?
>
> I'll have basically a 4 tier app:
> 1. presentation
> 2. business logic
> 3. data layer containing standard SQL compliant queries
> 4. any database
>
> I'm looking for the most efficient way to design tier 3. I can't use
> stored procedures because those are specific two a particular database.
> Using queries in an app layer is less efficient than SPs but there isn't
> much choice at this point.
>
> Any comments in general on this design are welcome.
"Any comments"... ;-)
Alright then...
>From your specifications I would split the "data layer" really into two.
3a. data layer containing standard SQL compliant queries
3b. A "pluggable" DB-proxy
This would mean that the proxy would be specific for a database, but would
be easy enough to implement for other DBs as you'd need them, so you could
exchange it, even "on the fly".
Using reflection you could even make some of the implementations enough
flexible to be able to be used in e "generic" way, i.e. for more than one
database...
The key to this solution is to *not* expose any DB-specific classes from the
proxy, only the necessary interfaces (IDbConnection, IDbCommand, etc).
But as I said, this was based "from your specifications", and you said you
accepted "any comments"... ;-)
My first thought was actually to include yet another layer between the
business logic and the data layer, on a higher abstraction level than to use
SQL queries, as not all databases even support standard SQL...
// Bjorn A
.
- Follow-Ups:
- Re: How to do non dependence on database vendor?
- From: Brett
- Re: How to do non dependence on database vendor?
- References:
- How to do non dependence on database vendor?
- From: Brett
- How to do non dependence on database vendor?
- Prev by Date: Re: How to do non dependence on database vendor?
- Next by Date: Re: DataAdapters, DataSets, DataTables
- Previous by thread: Re: How to do non dependence on database vendor?
- Next by thread: Re: How to do non dependence on database vendor?
- Index(es):
Relevant Pages
|