title: Can't use Asp.net core 2.0 with entity framework 6
body: <p>I follow link <a href="https://docs.microsoft.com/en-us/aspnet/core/data/entity-framework-6" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/aspnet/core/data/entity-framework-6</a> to do this.
  But when I run prọect, It occur error </p>
  
  <blockquote>
    <p>ConfigurationErrorsException: Configuration system failed to
    initialize
    System.Configuration.ClientConfigurationSystem.EnsureInit(string
    configKey)
    System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(string
    sectionName)
    System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(string
    sectionName)
    System.Configuration.ConfigurationManager.GetSection(string
    sectionName)
    System.Configuration.ConfigurationManager.get_ConnectionStrings()
    System.Data.Entity.Internal.AppConfig..ctor()
    System.Data.Entity.Internal.AppConfig..cctor()</p>
  </blockquote>
  
  <p>raw exception details</p>
  
  <blockquote>
    <p>TypeInitializationException: The type initializer for
    'System.Data.Entity.Internal.AppConfig' threw an exception.
    System.Data.Entity.Internal.LazyInternalConnection..ctor(DbContext
    context, string nameOrConnectionString)
    System.Data.Entity.DbContext..ctor(string nameOrConnectionString)
    Repositories.EF6.Context.MyDbContext..ctor()
    Repositories.EF6.Implements.FakeLinkRepository..ctor()
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCreateInstance(CreateInstanceCallSite
    createInstanceCallSite, ServiceProvider provider)
    ....</p>
  </blockquote>
  
  <p>I have divided the entity framework into a separate project, Can anyone have idea to fix it</p>
  
  <p>This is my code 
  In EF6 project run on .net framework 4.6.1</p>
  
  <pre><code>    [DbConfigurationType(typeof(MySqlEFConfiguration))] 
  public class MyDbContext : DbContext
          {
  
              public MyDbContext():base(GlobalVariables.ConnectionString == null ? "name=defaultConnectionString" : GlobalVariables.ConnectionString)
              {
  
              }
              public MyDbContext(string connectionString):base(connectionString)
              {
  
              }
             .......
  
      }
  
  public class MyDbConfiguration : MySqlEFConfiguration
      {
          public MyDbConfiguration()
          {
              SetProviderServices("MySql.Data.MySqlClient", new MySqlProviderServices());
              SetDefaultConnectionFactory(new MySqlConnectionFactory());
          }
      }
  </code></pre>
  
  <p>My repository </p>
  
  <pre><code>public class MyRepository : Repository
      {
          MyDbContext _context;
          public MyRepository ()
          {
              _context = new MyDbContext();
          }
       .....
  }
  </code></pre>
  
  <p>In asp.net core 2.0 
  GlobalVariables.ConnectionString get value of connectionString on appSetting.json and MyDbContext is created by DI create MyRepository</p>
  
  <p>Static class GlobalVariables on Standard class 2.0</p>
  
  <p>This is Error when I run my project asp.net core 2.0 againt</p>
  
  <p>ConfigurationErrorsException: Unrecognized configuration section system.data. </p>
  
  <p>file config is :</p>
  
  <pre><code>&lt;configSections&gt;
      &lt;!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --&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;connectionStrings&gt;
      &lt;add name="defaultConnectionString" providerName="MySql.Data.MySqlClient" connectionString="server=localhost;user id=root;password=admin;database=té;persistsecurityinfo=True" /&gt;
    &lt;/connectionStrings&gt;
    &lt;entityFramework&gt;
      &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"&gt;
        &lt;parameters&gt;
          &lt;parameter value="mssqllocaldb" /&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="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.10.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"&gt;&lt;/provider&gt;
      &lt;/providers&gt;
    &lt;/entityFramework&gt;
    &lt;system.data&gt;
      &lt;DbProviderFactories&gt;
        &lt;remove invariant="MySql.Data.MySqlClient" /&gt;
        &lt;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.9.10.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /&gt;
      &lt;/DbProviderFactories&gt;
    &lt;/system.data&gt;
  </code></pre>
  
  <p><strong>Update, I found the problem, maybe .net core 2.0 don't support system.Data.Common. I found on nuget but only found this library support with .net standard 1.2.
  I think can't use entity framework 6 with asp.net core 2.0, wait for next update.</strong></p>