Click here to Skip to main content
15,880,796 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900