在类库包放在实体框架7 BETA4无法运行迁移 [英] Cannot run migration on Entity Framework 7 beta4 in class library package

查看:146
本文介绍了在类库包放在实体框架7 BETA4无法运行迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在类库包来执行迁移命令。
我dnvm版本(从global.json):

I am unable to execute migration command in a class library package. My dnvm version is (from global.json):

"sdk": {
        "version": "1.0.0-beta5-12021"
    }

我导入此。在我的项目的JSON

I'm importing this in my project JSON.

"dependencies": {
   "EntityFramework.Commands": "7.0.0-beta4",
   "EntityFramework.SqlServer": "7.0.0-beta4",
   "Microsoft.CSharp": "4.0.0-beta-22816",
   "System.Collections": "4.0.10-beta-22816",
   "System.Linq": "4.0.0-beta-22816",
   "System.Threading": "4.0.10-beta-22816",
   "EntityFramework.Core": "7.0.0-beta4"
},
"commands": {
   "ef": "EntityFramework.Commands"
}

在我的DbContext我OnConfiguring方法继承的类是

My OnConfiguring method in my DbContext inherited class is

protected override void OnConfiguring(DbContextOptionsBuilder    optionsBuilder)
    {
        optionsBuilder.UseSqlServer(@"Server=(localdb)\ProjectsV12;Database=Ef7;Trusted_Connection=True;");
    }



但是当我运行 DNX。 EF迁移添加初始
我得到以下的输出:

But when I run dnx . ef migration add initial I get the following output:

System.ArgumentNullException: Value cannot be null.
Parameter name: appEnv
   at Microsoft.Data.Entity.Utilities.Check.NotNull[T](T value, String parameterName)
   at Microsoft.Data.Entity.Commands.Program..ctor(IServiceProvider serviceProvider, IApplicationEnvironment appEnv, ILibraryManager libraryManager)

我一直在试图搞清楚了这一点的有一段时间了,因此所有的帮助表示赞赏。谢谢你。

I've been trying to figuring this out for a while now, so all help is appreciated. Thanks.

推荐答案

我刚刚找到一种方法来解决这个问题。这似乎与coreclr最新版本的发生。而不是调用的

I just found a way to work around this. This seem to be happening with the latest version of the coreclr. Instead of calling

dnvm install -r coreclr latest

我叫下面从最新版本切换到BETA4。

I called the following to switch from the latest version to beta4.

dnvm use 1.0.0-beta4 -r coreclr

当我称之为DNX。EF,实体框架迁移工具启动。

When I call "dnx . ef", the Entity Framework migration tool starts.

这篇关于在类库包放在实体框架7 BETA4无法运行迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆