SQL Server精简版与实体框架 [英] SQL Server Compact Edition with Entity Framework
问题描述
我尝试在Visual Studio 2008 SP1使用SQL Server精简版与实体框架。这是我做的:
I try to use SQL Server Compact Edition with Entity Framework in Visual Studio 2008 SP1. Here's what I do:
1)我创建类型控制台应用程序的一个新项目,
1) I create a new project, of type Console Application.
2)在项目中,我单击鼠标右键,选择添加 - >新建项目。
2) I right-click on the project, select Add->New Item.
3)我选择添加一个名为Something.sdf本地数据库
3) I choose to add a Local Database called Something.sdf
4)在添加新项向导的下一个页面,我选择默认的数据集名称(SomethingDataSet)
4) In the next page of the "Add New Item" wizard, I choose the default dataset name (SomethingDataSet)
现在,在服务器资源管理器,新的数据库Something.sdf是根据数据连接中。
5)我右键单击该项目再次,然后选择添加 - >新建项目。
Now, in the Server Explorer, the new database Something.sdf is shown under Data Connections. 5) I right click on the project again, and select Add->New Item.
6)我选择增加一个ADO.NET实体数据模型使用默认名称,Model1.edmx
6) I choose to add a ADO.NET Entity Data Model with the default name, Model1.edmx
7)在向导的下一个页面,我选择生成数据库模型。
7) In the next page of the wizard, I choose to generate model from database.
现在它问我哪个数据连接应应用程序中使用连接到数据库?。在此对话框中,我可以使用预先创建的数据连接,或创建一个新的连接之间进行选择。
Now it asks me "Which data connection should your application use to connect to the database?". In this dialog, I can choose between using a pre-created Data connection, or to create a new connection.
下拉预创建的数据连接为空(我没有料想到会在这里看到我的Something.sdf?)。当我按下新建连接,我只能的Microsoft SQL Server,Microsoft SQL Server数据库文件之间进行选择,而且 - 我不能选择的Microsoft SQL Server CE。如果我选择其他,数据源的.NET Framework数据提供程序SQL Server显示,这不是我想要的。
The drop down with pre-created data connections is empty (I would have expected to see my Something.sdf here?). When I press New Connection, I can only choose among Microsoft SQL Server, Microsoft SQL Server Database File, and - I can't choose Microsoft SQL Server CE. If i choose Other, the data source ".NET Framework Data Provider for SQL Server" is shown, which is not what I want.
我缺少的是在这里吗?为什么我不能选择我的SQL Server CE数据库添加实体数据模型向导?
What am I missing here? Why can't I select my SQL Server CE database in the Add Entity Data Model Wizard?
推荐答案
不知道这是同样的问题,但我认为必须下载SQL Server Management Studio中快递2008获得CE作为下拉列表的选项。我会看起来更成为它虽然并给你一个更好的响应
Not sure if this is the same problem, but I think had to download SQL Server Management Studio Express 2008 to get CE as an option in the dropdown. I'll look more into it though and give you a better response.
编辑:
如果您浏览到:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config
If you browse to: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config
你应该找到以下节点:
you should find the following node:
<configuration>
<system.data>
<DbProviderFactories>
<add name="Microsoft SQL Server Compact Data Provider" invariant="System.Data.SqlServerCe.3.5" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
让我知道,如果你没有找到它。
Let me know if you do not find it.
编辑2:
我一直在运行VS 2010 Beta 1中,你所列出的过程让我选择SQL CE。不过,我启动了2008年和得到同样的结果,你,SQL CE不再是一个数据源的选项。
I've been running VS 2010 beta 1, and the process you listed allows me to select SQL CE. However, I fired up 2008 and get the same result as you, SQL CE is no longer an option for a datasource.
我第一次在2008年开始我的项目而回,我不得不请安装实体框架Beta 3的Microsoft SQL Server压缩3.5 SP1测试版,如下面的链接注意:
I first started my project in 2008 a while back, and I had to install "Microsoft SQL Server Compact 3.5 SP1 Beta for Entity Framework Beta 3", as noted in the following link:
的 http://technet.microsoft.com/en-us/library/cc835494.aspx
但是,下载似乎没有可用任何更长。我找不到任何地方,并在文章中所提供的链接断开。
However, the download does not seem to be available any longer. I couldn't find it anywhere and the link they provide in the article is broken.
升级到2010后,我遇到了被与CE一种选择同样的问题,所以我尝试重新安装VS 2008 SP1,并最终发现,所有我需要做的就是补充一点,我上面在C machine.config中提到的节点:\WINDOWS\Microsoft.NET\Framework\v4 .0.20506\Config。
After upgrading to 2010 I ran into the same problem with CE not being an option, so I tried re-installing VS 2008 SP1, and eventually found out that all I had to do was add the node that I mentioned above to the machine.config in C:\WINDOWS\Microsoft.NET\Framework\v4.0.20506\Config.
对不起,我已经不能更多的帮助,但我想我的2008 SP1是从同一个问题你的是痛苦。
Sorry I couldn't have been more help, but I guess my 2008 SP1 is suffering from the same problem yours is.
编辑3:
看样子2008 SP1应该没有必要安装一个为实体框架精简3.5 SP1测试'只是工作',但是当我试图安装Service Pack 1 2008年,我仍然得到同样的症状。只想到剩下的就是试图重新安装一些SQL CE 3.5组件。
Edit 3: It appears 2008 SP1 should 'just work' with no need to install an "Compact 3.5 SP1 Beta for Entity Framework" but when I tried installing Service Pack 1 for 2008 I am still getting the same symptom. Only thought left is trying to re-install some SQL CE 3.5 components.
这篇关于SQL Server精简版与实体框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!