实体框架7逆向工程并不起作用

时间:2015-10-30 16:52:06

标签: reverse-engineering asp.net-core dnx entity-framework-core

我在Windows 10上运行Visual Studio 2015。 这是我的project.json和global.json

{
  "version": "1.0.0-*",
  "description": "Application.Data Class Library",
  "authors": [ "------" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",

  "frameworks": {
    "dnx451": {
    }
  },
  "dependencies": {
    "EntityFramework.SqlServer": "7.0.0-rc1-15886",
    "EntityFramework.Commands": "7.0.0-rc1-15945",
    "EntityFramework.Core": "7.0.0-rc1-15945",
    "EntityFramework.SqlServer.Design": "7.0.0-rc1-15886"
  },

  "commands": {
    "ef": "EntityFramework.Commands"
  }  
}

{
  "projects": [ "Application.Data", "Application.WebApi" ],
  "sdk": {
    "version": "1.0.0-rc1-16048",
    "runtime": "clr",
    "architecture": "x86"
  }
}

当我运行dnx时,我收到此消息错误

C:\Users\-------\Documents\Visual Studio 2015\Projects\Application\Application.Data>dnx ef --help
System.InvalidOperationException: No service for type 'Microsoft.Dnx.Runtime.IRuntimeEnvironment' has been registered.
   à Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   à Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService[T](IServiceProvider provider)
   à Microsoft.Data.Entity.Commands.Program..ctor(IServiceProvider dnxServices)

1 个答案:

答案 0 :(得分:3)

dnx版本rc1-16048是最新版本,但您使用的是旧版本的EF(以及相互冲突的版本)。此外,SqlServer has been renamedMicrosoftSqlServerThe latest versions as of this writing are:

"EntityFramework.Commands": "7.0.0-rc1-16147",
"EntityFramework.Core": "7.0.0-rc1-16147",
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-16147",
"EntityFramework.MicrosoftSqlServer.Design": "7.0.0-rc1-16147"