Is Visual Studio 2010 compatible with Entity Framework 5's LocalDB?

c# entity-framework localdb

Question

Does Visual Studio 2010 support LocalDB in Entity Framework 5 on.NET 4.0?

Or am I mishandling this? I'm having trouble instantiating my model container with a connection string for LocalDB since it says "The network path can't be identified."

The connection string is as follows:

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\"";

Edit 1 When connecting, I get the following problem, specifically:

While attempting to connect to SQL Server, an issue either linked to the network or an instance-specific fault occurred. The server could not be accessed or could not be located. Verify that SQL Server is set up to accept remote connections and that the instance name is accurate. (provider: Named Pipes Provider; error code 40 - Could not establish a connection to SQL Server)

Edit 2 I've now discovered that switching to Visual Studio 11 beta also doesn't work. Receive the same problem message still.

1
7
3/18/2012 5:54:14 PM

Accepted Answer

The issue was as easy as my database needed a backslash to escape.

The database's name is "(localdb)v11.0," as you can see. It treats "v" as part of the connection string since the backslash in the original connectionstring is not at all escaped.

avoiding it by being specific"\\v" in place of"\v" worked.

6
5/27/2013 5:56:46 AM

Popular Answer

It's a little late for me to be of assistance, but I thought it would be of use to others that come in (just like me).

a detailed tutorial on using LocalDB with Visual Studio 2010.

http://blogs.msdn.com/b/sqlexpress/archive/2011/11/28/using-localdb-in-visual-studio-2010.aspx



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow