为SQL Compact 4设置EF4数据源 [英] Setup EF4 data source for SQL Compact 4

查看:122
本文介绍了为SQL Compact 4设置EF4数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了visual studio 2010 SP1,EF 4.1,SQL Compact 4.0与vs工具。一切都显示好了,除了我不能使用SQL Compact 4作为Entity框架的数据源通过向导。唯一的选择是SQL Compact 3.5。

I've installed visual studio 2010 SP1, EF 4.1, SQL Compact 4.0 with vs tools. Everything is appears ok, except I can't use SQL Compact 4 as a data source for Entity framework through the wizard. The only alternative is SQL Compact 3.5.

有没有补丁或我失踪的东西?有没有人有EF 4和SQL Compact 4.0一起工作,而不是一切。

Is there a patch or something I'm missing? Has anyone got EF 4 and SQL Compact 4.0 working together without hacking everything.

推荐答案

不,你没有丢失任何东西。在VS2010SP1中,仅在Web项目中支持SQLCE40。您可以通过 SQL Server Compact Toolbox 获得4.0 EDM支持,该工具将添加功能作为VS2010SP1的加载项(这显示在服务器中资源管理器选项卡作为图标)。它可以很好地创建edmx文件和一个modelname.App.Config文件,您可以使用它来获取项目App.Config文件的连接字符串。但是您需要在服务器资源管理器中进行大部分的工作,而不是在解决方案资源管理器中,这将投诉添加SQLCE40 dbs。请注意,如果不使用数据库名称(默认)作为型号名称,则必须编辑连接字符串,但这很简单。一旦edmx到位,连接字符串被复制到App.Config文件。您可以使用可视化的edmx设计器与SQLCE35 dbs相同。还要注意,Microsoft SQL Server Management Studio不支持SQLCE40 dbs。

No you're not missing something. In VS2010SP1 SQLCE40 is supported only in web projects. You can get 4.0 EDM support with SQL Server Compact Toolbox which adds the functionality as an add-in to VS2010SP1 (this shows up in the Server Explorer tab as an icon). It works well at creating the edmx file and a modelname.App.Config file that you can use to grab the connection string for your projects App.Config file. But you need to do most all of the work over in the Server Explorer and not in the Solution Explorer which will complain about adding SQLCE40 dbs. Note that if you don't use the db name (default) as the model name you will have to edit the connection string but this is easy. Once the edmx is in place and the connection string is copied over to the App.Config file. You can use the visual edmx designer the same as you could with SQLCE35 dbs. Also be aware that Microsoft SQL Server Management Studio does not support SQLCE40 dbs either.

这篇关于为SQL Compact 4设置EF4数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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