为什么我不能用类库与EF 6.1.3从Asp.Net MVC 5 6项目 [英] Why can't I use Class Library with EF 6.1.3 from Asp.Net 5 MVC 6 project

查看:191
本文介绍了为什么我不能用类库与EF 6.1.3从Asp.Net MVC 5 6项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.NET 4.5.1类库与实体框架6.1.3数据库首先模型,当我从我的单元测试项目测试工作正常。

I have a .net 4.5.1 class library with Entity Framework 6.1.3 Database First Model in it that works fine when i test it from my unit test project.

但是,当我试图从我的ASP.NET MVC 5 6项目中使用它(dnx451只),我总是得到一个错误说:

But when I try to use it from my ASP.NET 5 MVC 6 project (dnx451 only) I always get an error saying:

FileNotFoundException: Couldn't find file EntityFramework.resources.
at System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(String name, CultureInfo culture, Version version, Boolean throwOnFileNotFound, StackCrawlMark& stackMark)
at System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly(CultureInfo lookForCulture, StackCrawlMark& stackMark)

我觉得它曾经在第一次合作,但随后停止了工作,我无法找到它的原因。

I think it used to work at first, but then it stopped working and I can't find the reason for it.

任何人都见过这个错误,或者知道它是什么?

Anyone seen this error before, or know what it is??

推荐答案

确定,这是一个错误,这是在这里报道:的 https://github.com/aspnet/dnx/issues/3047

OK, this is a bug, which is reported here: https://github.com/aspnet/dnx/issues/3047

Joplaal评论这一点:

Joplaal commented with this:

这是一个非常重要的问题,因为它prevents使用非常普遍
  图书馆,像实体框架6从DNX项目,在电流
  螺纹文化比不变的文化等。

This is a very important issue, since it prevents to use very popular libraries, like Entity Framework 6 from DNX projects, when current thread culture is other than invariant culture.

在我们等待一个解决方法,您可以通过添加给你的Startup的配置方法,清除任何本地化支持。

While we wait for a fix, you can remove any localisation support by adding this to your Startup's Configure method.

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    //...
    var localizationOptions = new RequestLocalizationOptions()
    {
        SupportedCultures = new List<CultureInfo> { new CultureInfo("") },
        SupportedUICultures = new List<CultureInfo> { new CultureInfo("") }
    };

    var invariantCulture = new RequestCulture(new CultureInfo(""), new CultureInfo(""));

    app.UseRequestLocalization(localizationOptions, invariantCulture);
    //...
}

我在谷歌搜索这一个这么辛苦,它已经我填写的验证码。

I was Googling this one so hard, it had me filling out captchas.

这篇关于为什么我不能用类库与EF 6.1.3从Asp.Net MVC 5 6项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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