title: Postgresql and Entity Framework
body: <p>In my project I am trying to use Entity Framework along with PostgreSql. But I am not able to connect to my database. I am not getting any error, it just gets stuck. I think something is wrong with my <code>app.config</code>, but I am not able to find out what.</p>
  
  <p>App.config:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
      &lt;configSections&gt;
          &lt;section name="entityFramework" 
                   type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt;
      &lt;/configSections&gt;
      &lt;entityFramework&gt;
          &lt;defaultConnectionFactory type="Npgsql.NpgsqlFactory, Npgsql" /&gt;
          &lt;providers&gt;
              &lt;provider invariantName="Npgsql" 
                        type="Npgsql.NpgsqlServices, Npgsql.EntityFramework"  /&gt;
          &lt;/providers&gt;
      &lt;/entityFramework&gt;
      &lt;system.data&gt;
          &lt;DbProviderFactories&gt;
              &lt;add name="Npgsql Data Provider" invariant="Npgsql" 
                   description="Data Provider for PostgreSQL" 
                   type="Npgsql.NpgsqlFactory, Npgsql" /&gt;
          &lt;/DbProviderFactories&gt;
      &lt;/system.data&gt;
      &lt;connectionStrings&gt;
          &lt;add name="Entities" 
               connectionString="server=localhost;user id=postgres;password=4321;database=postgis" 
               providerName="Npgsql" /&gt;
      &lt;/connectionStrings&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p><code>DbContext</code>:</p>
  
  <pre><code>public class Entities : DbContext
  {
      public Entities() : base("Entities")
      {
      }
  
      //rest of the code
  }
  </code></pre>
  
  <p>mycode.cs  </p>
  
  <pre><code>using (var db = new Entities()) // when debug it stuck here and keep running 
  {
   // some test code
  }
  </code></pre>
  
  <p>EDIT:  </p>
  
  <p>I get the following error :<br>
  "The Entity Framework provider type 'Npgsql.NpgsqlServices, Npgsql.EntityFramework' registered in the application config file for the ADO.NET provider with invariant name 'Npgsql' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application.</p>