简体   繁体   English

支持SQL Server 2005和2008

[英]Support SQL Server 2005 and 2008

i want to know how it is possible to use the Entity Framework against the SQL Server 2008 and 2005? 我想知道如何对SQL Server 2008和2005使用实体框架?

I develop a application against the SQL Server 2008 and want that it can run under 2005 and 2008. I know that it is possible to change the ProviderManifestToken from 2008 to 2005 in the edmx Schema File in a Texteditor. 我针对SQL Server 2008开发了一个应用程序,并希望它可以在2005和2008下运行。我知道可以在Texteditor的edmx Schema文件中将ProviderManifestToken从2008更改为2005。 But after i update my Model from the Database it changes the ProviderManifestToken back to 2008. 但是在我从数据库更新我的模型后,它将ProviderManifestToken更改回2008。

How can i told Visiual Studio to use the the 2005 Schema when i update my model from Database? 当我从数据库更新我的模型时,我如何告诉Visiual Studio使用2005 Schema?

Thanks for any Help! 谢谢你的帮助!

Nico 尼科

Read my blog post on EF and ProviderManifestToken. 阅读我关于EF和ProviderManifestToken的博文

Using the MSBuild.Community Tasks , I added a BeforeBuild Target that uses the XmlUpdate task to always change the ProviderManifestToken to 2005, in case someone changed it by updating the data model. 使用MSBuild.Community Tasks ,我添加了一个BeforeBuild Target,它使用XmlUpdate任务始终将ProviderManifestToken更改为2005,以防有人通过更新数据模型对其进行更改。

Here is the BeforeBuild Target: 这是BeforeBuild目标:

<Target Name="BeforeBuild"> <XmlUpdate Prefix="ssdl"
            Namespace="http://schemas.microsoft.com/ado/2009/02/edm/ssdl"
            XPath="//ssdl:Schema/@ProviderManifestToken"
            XmlFileName="Model.edmx"
            Value="2005"/>

I think the manual (hack!) edmx change is the only way at the moment. 我认为手册(黑客!)edmx改变是目前唯一的方式。 Particularly annoying when you forget and deploy it to an environment with 2005. :) 当你忘记并将它部署到2005年的环境时特别烦人。:)

I'd like to know another way... 我想知道另一种方式......

The easiest way is to put your source database into SQL 2005 compability mode (level 90) on your SQL 2008 server. 最简单的方法是在SQL 2008服务器上将源数据库置于SQL 2005兼容模式(级别90)。 You can use ALTER DATABASE to do that. 您可以使用ALTER DATABASE来执行此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio 2005不支持Sql Server 2008 - Visual Studio 2005 doesn't support Sql Server 2008 Nhibernate HQL SQL Server 2005/2008包含 - Nhibernate HQL SQL Server 2005 / 2008 CONTAINSTABLE 从2005年到2008年更新sql server时出现LINQ问题 - LINQ issue while updating sql server from 2005 to 2008 无法连接到SQl Server 2008 Express / SQl Server 2005(本地)-错误40(找不到服务器/无法访问服务器) - Unable to connect to SQl Server 2008 Express / SQl Server 2005 (Local) - Error 40 (Server was not found / not accessable) 在SQL Server 2005上进行生产时针对SQL Server 2008进行开发的风险有多大 - How risky is development against SQL Server 2008 with production on SQL Server 2005 升级到SQL Server 2008:升级使用BCP的VS2005 .NET程序 - Upgrading to SQL Server 2008: Upgrading a VS2005 .NET program that uses BCP 卸载SQL Server Express 2005,然后在C#ClickOnce Winform应用程序中安装SQL Server 2008 R2 Express - Uninstall SQL Server Express 2005 then install SQL Server 2008 R2 Express in C# ClickOnce Winform App VS 2013 SQL Server数据工具是否支持SQL Server 2008 R2? - Does VS 2013 SQL Server Data Tools support SQL Server 2008 R2? 设置 SQL Server 2005 的区域设置 - Set Locale of a SQL Server 2005 sql server 2005和.net查询 - sql server 2005 and .net query
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM