unable to retrieve metadata for unrecognized element providers

前端 未结 2 2005
礼貌的吻别
礼貌的吻别 2021-02-12 16:22

I get a message error whenever I try to add a controller with Entity framework template but I keep getting a error message

    unable to retrieve metadata for \'         


        
相关标签:
2条回答
  • 2021-02-12 16:43

    I was able to fix this issue by removing the <providers> section of the configuration file.

    This:

    <entityFramework>
      <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
      <providers>
        <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      </providers>
    </entityFramework>
    

    Becomes this:

    <entityFramework>
      <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    </entityFramework>
    

    I had this issue this morning and just found the fix. If you don't specify the database (and provider I guess) EF will default to SQL Server Express.

    0 讨论(0)
  • 2021-02-12 16:44

    MVC scaffolding does not support Entity Framework 6 or later

    Please unistall current version Entity Framework, vs Install-Package EntityFramework -Version 5.0.0.

    Delete tag ...

    Restart VS

    OK

    0 讨论(0)
提交回复
热议问题