实体框架代码优先在服务器资源管理器中找不到数据库 [英] Entity Framework Code First can't find database in server explorer

查看:76
本文介绍了实体框架代码优先在服务器资源管理器中找不到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我遵循了Entity Framework Code First的介绍,以创建一个新数据库( https://msdn.microsoft.com/zh-cn/data/jj193542 ),我完全按照示例进行操作。现在,我想将其添加到Visual Studio 2013中的服务器浏览器中。

So I was following this introduction to the Entity Framework Code First to create a new database ( https://msdn.microsoft.com/en-us/data/jj193542 ) and I followed the example completely. Now I want to add it to my server explorer in Visual Studio 2013.

尝试了LocalDb((localdb)\v11.0)或SQL Express(.\ SQLEXPRESS),但数据库没有显示,我知道它正在工作,因为我已经对其进行了多次测试,并且它不断从数据库中追加和提取数据,所以它将驻留在哪里?

Tried both LocalDb ((localdb)\v11.0) or SQL Express (.\SQLEXPRESS) but the database doesn't show, I know it's working because I've tested it multiple times now and it keeps appending and fetching data from the database, so where would it be residing?

除了默认的Visual Studio 2013,我还有一个SQL Server安装程序。谢谢

Besides the default Visual Studio 2013 I have an SQL Server setup. Thanks

<configuration> 
  <configSections> 
    <!-- For more information on Entity Framework configuration, visit go.microsoft.com/fwlink/… --> 
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
  </configSections> 
  <startup> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> 
  </startup> 
  <entityFramework> 
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> 
      <parameters> 
        <parameter value="mssqllocaldb" /> 
      </parameters> 
    </defaultConnectionFactory> 
    <providers> 
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> 
    </providers> 
  </entityFramework> 
</configuration>


推荐答案

查看您的配置(在聊天过程中提供),我可以看到您的EF使用的是localdb和 MSSQLLocalDB 实例。
尝试:

Looking at your config (supplied during chat) I can see that your EF is using localdb and MSSQLLocalDB instance. Try:

(localdb)\MSSQLLocalDB

这篇关于实体框架代码优先在服务器资源管理器中找不到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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