Click here to Skip to main content
14,661,186 members
Rate this:
Please Sign up or sign in to vote.
Hi All,
I am trying to open PostgreSQL connection but getting ReflectionTypeLoadException while opening connection.

Please help me out to solve this problem by providing code or let me know how to remove this exception.

Code i am using so far is below:
<configuration>
  <appsettings>
    <add key="superuserDatabase" value="postgres" />
  </appsettings>

  <system.data>
    <dbproviderfactories>
      <clear />
      <add name="Npgsql Data Provider">
           invariant="Npgsql"
           description=".Net Framework Data Provider for Postgresql Server"
           type="Npgsql.NpgsqlFactory, Npgsql" />
    </add></dbproviderfactories>
  </system.data>

  <connectionstrings>
    <add name="Simple.Data.Properties.Settings.DefaultConnectionString">
          connectionString="host=localhost;port=5432;database=SimpleData;user id=postgres;password=P@ssw0rdsa;pooling=false"
          providerName="Npgsql" />
    <add name="Test">
          connectionString="host=localhost;port=5432;database=SimpleData;user id=postgres;password=P@ssw0rdsa;pooling=false"
          providerName="Npgsql" />
  </add></add></connectionstrings>
</configuration>



I am getting following exception when trying to open connection in POSTGRESQL
var namedDb = Database.OpenNamedConnection("Test").Demo.All();

ReflectionTypeLoadException


Thanks & Regards,
Vishal Patel
Posted
Updated 15-Oct-13 6:53am
v2
Comments
Bernhard Hiller 16-Oct-13 2:51am
   
var namedDb = Database.OpenNamedConnection("Test").Demo.All();
is a chain of three calls. What about doing them one after the other, and thus find out which one fails?
vishalmg 16-Oct-13 5:26am
   
It fails on
var namedDb = Database.OpenNamedConnection("Test");
Bernhard Hiller 16-Oct-13 10:40am
   
And what is that "Database" object, in which namespace can it be found? Is that part of teh "normal" .Net framework?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100