title: Entity Framework providers must declare a static property or field named 'Instance' that returns the singleton instance
body: <p>I am using Entity Framework 6 in a ASP.NET MVC application. I am using a Code First approach to try and connect to an existing database.</p>
  
  <p>Firstly, I have set up a Model as follows:</p>
  
  <pre><code>public class Employee
  {
      public int ID { get; set; }
      public string PAYCODE { get; set; }
  }
  </code></pre>
  
  <p>Secondly, I have a Context as follows:</p>
  
  <pre><code>public class EmployeeContext : DbContext
  {
      public EmployeeContext()
          : base("EmployeeDB")
      {
      }
  
      public DbSet&lt;Employee&gt; Employees { get; set; }
  }
  </code></pre>
  
  <p>Thirdly, I have specified the connection to the DB in the web.config:</p>
  
  <pre><code>&lt;connectionStrings&gt;
      &lt;add name="EmployeeDB" connectionString="Server=MyServer;Database=MyDB;User ID=MyUserID;Password=MyPassword;Trusted_Connection=False" providerName="System.Data.SqlClient" /&gt;
  &lt;/connectionStrings&gt;
  </code></pre>
  
  <p>Finally, I call my context from a Controller class as follows:</p>
  
  <pre><code>  var db = new EmployeeContext();
  </code></pre>
  
  <p>However, this throws the following run-time error:</p>
  
  <blockquote>
    <p>The Entity Framework provider type 'System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' did not have a static property or field named 'Instance'. Entity Framework providers must declare a static property or field named 'Instance' that returns the singleton instance of the provider.</p>
  </blockquote>
  
  <p>I would be extremely grateful if anyone can shed some light on this error - I have tried searching on the Web, and have followed Microsoft examples.</p>
  
  <p>Many thanks!</p>
  
  <p>Martin</p>
  
  <p>Added in response to question below:
  The following is at the foot of my web.config:</p>
  
  <pre><code>&lt;entityFramework&gt;
  &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"&gt;
    &lt;parameters&gt;
      &lt;parameter value="v11.0" /&gt;
    &lt;/parameters&gt;
  &lt;/defaultConnectionFactory&gt;
  &lt;providers&gt;
    &lt;provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /&gt;
    &lt;provider invariantName="System.Data.OracleClient" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt;
  &lt;/providers&gt;
  </code></pre>
  
  <p></p>