开发者

LINQ to Entities, SQL Server version and setting ProviderManifestToken at runtime

We have developers some developers who are developing against a SQL Server 2005 database, while others are using 2008.

We just disc开发者_JAVA百科overed that generating the edmx against a 2008 database set the ProviderManifestToken to 2008, which means some queries won't work against a 2005 database.

While this is a known issue, is there any way to set this value at run time, based on a config file?


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"/>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜