PC Review


Reply
Thread Tools Rate Thread

Data Provider independent code

 
 
=?Utf-8?B?TWlrZQ==?=
Guest
Posts: n/a
 
      9th Sep 2004

Hi,

I would like to have a data layer that is independent from the data provider
and ADO.NET. What I mean is that I would like to have a project that is
reusable in other projects, which use SQL Server, Sybase, or MySQL.

The goal is to avoid duplicating code as much as possible. For example, I
would like to have one "Fill" method which works for any data provider.

Is this possible at all? Any link to articles/code?

Thanks
Mike


 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      9th Sep 2004
Mike,

That should be OleDB look at the connections strings for that.

http://www.connectionstrings.com/

Altough it is of course not independent from ADONET, because that is an
integrated part of dotNet.

(You loose with this approach of you of course performance when it is Oracle
or SQLserver)

I hope this helps?

Cor

> Hi,
>
> I would like to have a data layer that is independent from the data

provider
> and ADO.NET. What I mean is that I would like to have a project that is
> reusable in other projects, which use SQL Server, Sybase, or MySQL.
>
> The goal is to avoid duplicating code as much as possible. For example, I
> would like to have one "Fill" method which works for any data provider.
>
> Is this possible at all? Any link to articles/code?
>
> Thanks
> Mike
>
>



 
Reply With Quote
 
Joyjit Mukherjee
Guest
Posts: n/a
 
      9th Sep 2004
Hi,

what you really need is interface driven code, generic to any ADO.NET
provider. The following will help you
http://msdn.microsoft.com/library/de...a010112001.asp

Regards
Joyjit

"Mike" <(E-Mail Removed)> wrote in message
news:9C00D0FC-37A0-49FB-91C4-(E-Mail Removed)...
>
> Hi,
>
> I would like to have a data layer that is independent from the data

provider
> and ADO.NET. What I mean is that I would like to have a project that is
> reusable in other projects, which use SQL Server, Sybase, or MySQL.
>
> The goal is to avoid duplicating code as much as possible. For example, I
> would like to have one "Fill" method which works for any data provider.
>
> Is this possible at all? Any link to articles/code?
>
> Thanks
> Mike
>
>



 
Reply With Quote
 
Frans Bouma [C# MVP]
Guest
Posts: n/a
 
      9th Sep 2004
Mike wrote:

>
> Hi,
>
> I would like to have a data layer that is independent from the data
> provider and ADO.NET. What I mean is that I would like to have a project
> that is reusable in other projects, which use SQL Server, Sybase, or MySQL.
>
> The goal is to avoid duplicating code as much as possible. For example, I
> would like to have one "Fill" method which works for any data provider.
>
> Is this possible at all? Any link to articles/code?


this only works if you abstract away your SQL actions as well. If you don't
your code is never going to be independent of which database to use.

You can come a long way with interfaces, however not all actions are
implemented on the ADO.NET interfaces. One being savepoints in transactions
for example.

Frans.

--
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP
 
Reply With Quote
 
Paul Clement
Guest
Posts: n/a
 
      10th Sep 2004
On Thu, 9 Sep 2004 04:05:02 -0700, "Mike" <(E-Mail Removed)> wrote:

¤
¤ Hi,
¤
¤ I would like to have a data layer that is independent from the data provider
¤ and ADO.NET. What I mean is that I would like to have a project that is
¤ reusable in other projects, which use SQL Server, Sybase, or MySQL.
¤
¤ The goal is to avoid duplicating code as much as possible. For example, I
¤ would like to have one "Fill" method which works for any data provider.
¤
¤ Is this possible at all? Any link to articles/code?

Unfortunately this probably isn't possible. The data access layer will have to be written to handle
different implementations amongst database products, such as the manipulation of BLOB data, data
type support, auto increment or sequencing, etc.

Your best bet would be to use stored procedures, which would be in line with what Frans is
suggesting, but the bottom line is that the data access layer will have to be database product
aware.


Paul ~~~ (E-Mail Removed)
Microsoft MVP (Visual Basic)
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
color code series by an independent column of data rockdoc69 Microsoft Excel Charting 1 12th Sep 2008 10:54 AM
Typed DataSet with independent data provider? Hamed Microsoft ADO .NET 1 28th May 2008 05:45 PM
Provider independent data access: problem with Excel ODBC source =?Utf-8?B?SmltIFdhbHNo?= Microsoft ADO .NET 3 25th Apr 2007 05:41 PM
Provider-independent data access, again Massimo Microsoft ADO .NET 2 21st Oct 2006 07:12 PM
Provider independent data access: creating a data adapter from aconnection Harold Howe Microsoft ADO .NET 0 31st May 2006 10:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:18 AM.