是的LocalDB通过Visual Studio 2010中的实体框架5支持? [英] Is LocalDB supported by Visual Studio 2010 in Entity Framework 5?

查看:131
本文介绍了是的LocalDB通过Visual Studio 2010中的实体框架5支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

时的LocalDB在实体框架5 Visual Studio 2010的支持,在.NET 4.0?

Is LocalDB supported by Visual Studio 2010 in Entity Framework 5, on .NET 4.0?

还是我做错了? 。我的实例为的LocalDB连接字符串模型容器时,我得到一个网络路径未找到的问题。

Or am I doing it wrong? I'm getting a "The network path can't be found" issue when instantiating my model container with a connection string for LocalDB.

下面的连接字符串:

var connectionString = "metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string=\"data source=(localdb)\v11.0;initial catalog=fablelane_com_db;integrated security=SSPI;multipleactiveresultsets=True;App=EntityFramework\"";

修改1
我收到以下错误,当连接,更具体:

Edit 1 I'm receiving the following error when connecting, more specifically:

建立SQL Server的连接时发生网络相关的或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确,以及SQL Server配置为允许远程连接。 (provider:命名管道提供程序,error:40 - 无法打开到SQL Server的连接)

编辑2
口只是想通了,改变到Visual Studio 11 Beta版也不起作用。仍然收到相同的错误消息。

Edit 2 I just figured out that changing to Visual Studio 11 beta doesn't work either. Still receiving the same error-message.

推荐答案

这个问题是因为缺少反斜杠逃脱我的数据库这样简单的事情。

The problem was something as simple as a missing backslash to escape my database.

请注意数据库的名称是如何(的LocalDB)\v11.0。在原有的ConnectionString反斜杠没有逃过可言,所以它处理\v作为连接字符串的一部分。

Notice how the database's name is "(localdb)\v11.0". The backslash in the original connectionstring is not escaped at all, so it handles "\v" as part of the connection string.

通过指定摆脱它\\v而不是\v工作

Escaping it by specifying "\\v" instead of "\v" worked.

这篇关于是的LocalDB通过Visual Studio 2010中的实体框架5支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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