[Mono-list] How do I configure DbProviderFactory?

Francisco Figueiredo Jr. fxjrlists@yahoo.com.br
Sun, 28 Nov 2004 14:11:48 -0200


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi all,

Kangaroo made me a feature request to add DbProviderFactory support to
Npgsql. I searched web and found this article about it:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/vsgenerics.asp

But when I tried a simple test and a user .config file, I couldn't get
any providers available.


This is my .config file I created:

<?xml version="1.0"?>
<configuration>
<system.data>
~ <DbProviderFactories>
~ <add name="SqlClient Data Provider"
~  invariant="System.Data.SqlClient"
~   support="FF"
~    description=".Net Framework Data Provider for SqlServer"
~     type="System.Data.SqlClient.SqlClientFactory, System.Data,
~       Version=2.0.3600.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" />
~        <!-- other provider entries elided -->
~         </DbProviderFactories>
~         </system.data>

</configuration>



And this is the test file I created:

using System;
using System.Data;
using System.Data.Common;

public class t
{
~    public static void Main()
~    {
~        DbProviderFactory f =
DbProviderFactories.GetFactory("System.Data.SqlClient");
~        Console.WriteLine(f != null);
~    }

}



And this is its output:

Unhandled Exception: System.Configuration.ConfigurationException:
DataProvider is not found! ()
in <0x0007c> System.Data.Common.DbProviderFactories:GetFactory (string)
in <0x00012> t:Main ()




I'm sure I'm doing something wrong. Could you point me out some tips?

Thanks in advance.


- --
Regards,

Francisco Figueiredo Jr.
Membro Fundador do Projeto MonoBrasil - MonoBrasil Project Founder Member
http://monobrasil.softwarelivre.org



- -------------
"Science without religion is lame;
religion without science is blind."

~                  ~ Albert Einstein
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iQEVAwUBQan4xP7iFmsNzeXfAQINVwf/SILgzcIs2EF4B9hIP9adwwm2SoW6CfZ4
I3RsOHbiRNoeG0U5t2o1QPmFhjOGgzf8qm6Asih0nAkbKiJjKUhl+yCAfEeZDxwa
2BahzeTwC3ErToCdYkIVh0muVn0mcMRzUmyfAVBIIYVJqWvhocMM7nhg++GNgpmR
/EyIHbUXKu3t5KV4SXax89/vMoGkLy566XsPqzSUNhXxd5IGOXf5p6I2GtohQNri
kGr1+ORgO7MsBsVTdLVEGjb3+TfDN712ivKD1C7zFUTqYFQnBV5mKUX76hL5Xk9d
nu8Q4Cn9g8pMX74yyQO8Vg6RnrFSVFCrU+4MWueDZHyyEPqt5gZB3g==
=klHK
-----END PGP SIGNATURE-----