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?
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. But after i update my Model from the Datab开发者_如何转开发ase it changes the ProviderManifestToken back to 2008.
How can i told Visiual Studio to use the the 2005 Schema when i update my model from Database?
Thanks for any Help!
Nico
Read my blog post on EF and 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.
Here is the BeforeBuild Target:
<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. Particularly annoying when you forget and deploy it to an environment with 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. You can use ALTER DATABASE to do that.
精彩评论