Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
463 views
in Technique[技术] by (71.8m points)

ef code first - SSDT on Visual Studio 2012 broken then fixed, broken again also broken on VS2013

After installing Visual Studio 2012 Ultimate on Windows 8, SSDT via SQL Server Object Explorer did not work. The solution was to install the latest version of VS2012 from the MSDN website.

All was well. I could see databases, no problem. It did not matter whether I used the EF defaultConnectionFactory or my own connectionString, either way, all of my code first databases showed up in the VS2012 SQL Server Object Explorer.

Not long ago, I installed Visual Studio 2013 Ultimate. In VS2013 Ultimate, local db, all I see, via properties, is this connection string:

Data Source=(localdb)Projects;
Initial Catalog=master;Integrated Security=True;
Connect Timeout=30;Encrypt=False;TrustServerCertificate=False  

Next, when I tried to look via VS2012, VS2012 was again broken. To get VS2012 to work again, I installed the 2013 October version of SSDT for VS2012 from MSDN.

While VS2012 SSDT now worked again via SQL Server Object Explorer, unfortunately, the behaviour was identical to that of SSDT in VS2103.

I am able to connect via LINQPad4 which does have some advantages because of the useful LINQ choices that one gets simply by right-clicking on a table name.

Using EF 6.0.1 code first.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The clue is Data Source=(localdb)Projects;

EF 6.0.1 puts the databases here: Data Source=(localdb)v11.0;

Data Source=(localdb)v11.0;
Integrated Security=True;Connect Timeout=15;
Encrypt=False;TrustServerCertificate=False

in SSDT in vs2012/vs2013 [View, SQL Server Object Explorer],
right-click the node "SQL Server", then click "Add SQL Server..."

Type "(localdb)v11.0" for the server name and click Connect.

You should now see both "(localdb)v11.0" and "(localdb)Projects" in SQL Server Object Explorer.

Your code first databases will be in the Databases node under "(localdb)v11.0".

FWIW, i have zero idea why Microsoft made this annoying change.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...