How to add custom DB provider to be accessible in Visual Studio? How to add custom DB provider to be accessible in Visual Studio? postgresql postgresql

How to add custom DB provider to be accessible in Visual Studio?


You need to declare the DbFactoryProvider in a config file (Web.config, Machine.config, etc). Here's a sample one I pulled from a project using MySQL:

<system.data>  <DbProviderFactories>    <remove invariant="MySql.Data.MySqlClient"/>    <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>  </DbProviderFactories></system.data>

I also prefer declaring these in the application-level config files and have my apps use the local copy of the assembly. This helps with portability since we can't guarantee that the 3rd party provider is available in GAC.


Old(from 7 Fabruary 2013): It is impossible to add Npgsql provider to be accesible in Visual Studio, because NpgSql for now does not support DDEX.

Update on 29 of December 2013: It seems that DDEX support was added.


If you want to list up Npgsql in Datasource list in Visual Studio, this article may be a little helpful.

Anyway, since Visual Studio is delivered by Microsoft, obviously you need to work on the registry table.