[Mono-list] ADO.NET Provider Factory

Brian Ritchie brianlritchie@hotmail.com
Sat, 09 Nov 2002 11:58:43 -0500


Rodrigo,

Thanks for the review.  I guess great minds think alike...I actually already 
had a CreateConnectionFromConfig. :)

Here's the syntax for it:

IDbConnection 
conn=ProviderFactory.CreateConnectionFromConfig("PubsConnStr");

<appSettings>
  <add key="PubsConnStr" value="factory=System.Data.SqlClient; 
server=speedy;database=pubs;uid=sa;pwd=" />
</appSettings>

The factory attribute specifies which provider to use.  I parse out the 
factory attribute, crete the object, and then pass the rest of the 
connection string into the provider. The providers are definited in the 
app.config (or machine.config).

I'll get the code commited sometime today.

Brian


>From: Rodrigo Moya <rodrigo@ximian.com>
>To: Brian Ritchie <brianlritchie@hotmail.com>
>CC: Mono List <mono-list@ximian.com>
>Subject: Re: [Mono-list] ADO.NET Provider Factory
>Date: 09 Nov 2002 12:15:52 +0100
>
>On Mon, 2002-11-04 at 06:37, Brian Ritchie wrote:
> > I've started work on the set of objects known as... "ADO.NET
> > Multiplexor Provider" in... http://www.go-mono.com/ado-net.html
> >
> > I'd appreciate the ADO.NET team to review this (and attached files)
> > before I commit things to CVS. I'm planning to put them under
> > /mcs/class/Mono.Data. Please note: connection strings will in attached
> > files will need to be updated to match your configuration.  I've done
> > some basic testing of the code under MS.NET & Mono on Windows.
> >
>it looks ok to me. I would also add one thing though, which is a way to
>activate a given provider/connection string without having to know the
>provider to be used. That is, something like the ODBC (or libgda) data
>sources, on which you store, under a unique name, all parameteres needed
>for the connection to be established. Something like:
>
>IDbConnection cnc = ProviderFactory.CreateConnectionFromConfig
>("my_data_source");
>
>and then have, in the config file, an entry called "my_data_source"
>which contains the info for the provider and connection string to be
>used to open this given connection.
>
>Apart from that, it looks ok to me, so please commit as soon as you can.
>
>and sorry for the delay in answering, but I've been really busy these
>last weeks.
>
>cheers
>--
>Rodrigo Moya <rodrigo@ximian.com>


_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail