使用EF 4.4,而不是5.0 VS2012 [英] Using EF 4.4 and not 5.0 with VS2012

查看:117
本文介绍了使用EF 4.4,而不是5.0 VS2012的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们将一些项目从VS2010到VS2012,但仍然使用.NET 4.0和不可以 .NET 4.5

We move some projects from VS2010 to VS2012 but still using .NET 4.0 and not .NET 4.5

当我添加一个新的EDMX,VS2012采用EF 5.0,但我想继续使用4.x版这是第一点。

When I add an new EDMX, VS2012 use EF 5.0 but I'd like continue to use the version 4.x it's the first point.

二点5.0的版本,从的DbContext继承,而不是像的ObjectContext 4.x版随着5.0版本我没有看到任何方式来传递连接字符串参数。

Second point the version 5.0, inherit from DbContext and not ObjectContext like version 4.x. With the version 5.0 I don't see any way to pass the connection string as parameter.

我如何使用VS2012 4.x版,具有相同的EDMX设计师的行为呢?

How can I use version 4.x in VS2012, with the same EDMX designer behavior ?

谢谢

推荐答案

正如评论,你来说确实是EF 4.4,而不是5.0 EF。但是,容易混淆,EF 4.4包含在的NuGet的EntityFramework 5.0包。

As mentioned in the comments, you're really getting EF 4.4, not EF 5.0. However, confusingly, EF 4.4 in contained in the NuGet EntityFramework 5.0 package.

有关您的其他问题,您可以在设计师从无到默认打开EDMX,恢复code生成策略,然后在解决方案资源管理器中删除。 TT 文件。现在,你有你的的ObjectContext 再次,如果你愿意,你可以在你的项目中删除的EntityFramework包。

For your other question, you can open the EDMX in the designer, restore "Code generation strategy" from "None" to "Default", then in the solution explorer, remove the .tt files. Now you'll have your ObjectContext again, and if you wish, you can remove the EntityFramework package from your project.

我不知道是否有什么办法来改变加入的NuGet包的默认行为。

I'm not sure if there's any way to change this default behaviour of adding the NuGet package.

这篇关于使用EF 4.4,而不是5.0 VS2012的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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