ProviderManifestToken 2008 or 2012

不打扰是莪最后的温柔 提交于 2019-12-03 15:52:30
Frédéric

Since EF 6.1.2, having 2012as ProviderManifestToken value will cause EF to generate SQL using offset ... fetch ... syntax (not supported in MS Sql 2008) in a bunch of cases, like paging. So, if you let it get changed to 2012, you will very likely have troubles on apps running over MS Sql 2008.

Setting it to 2008 for running on newer Sql Server should be safe for now: deprecated features are usually not dropped until v+2 (where v is the first version in which they have been deprecated). Sorry, I am no more able to find a reference for this statement.

If you need to have it match the target DB for each of your deployments, this other SO answer may help you.

If you wish to set it as 2008 in any cases, ensuring that development DBs are all set to 100(SQL Server 2008) compatibility level should do the trick. Unfortunately it looks like EF designer does not always honor the compatibility level of the database on which it runs for updating the model. So when using it, it may "upgrade" the ProviderManifestToken value, causing troubles if the dev commit it and let it get deployed.

I was not able of reproducing this on my own workstation. But some devs in my company had the trouble, though they claim their local db is in 100 compatibility level.

It appears they were not having their SQL Server Management Studio (SSMS) default scripting option correctly set. (Tools => Options... => SQL Server Object Explorer => Scripting => Script for server version). Just in case, I made them change it, and for now they report no more having the undesired ProviderManifestToken value upgrade.

This looks quite weird to me, as SSMS options should not have any impact on EF designer. Only the database on which is run the designer should be taken into account IMHO. And as already stated, I was not able to reproduce this trouble myself, even by tweaking that option.

I solved this issue by installing Entity Framework 6 Tools for Visual Studio 2012, I downloaded it from here:

https://www.microsoft.com/en-us/download/details.aspx?id=40762

Hope this helps ...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!