Different SQL Server versions and Entity Framework (ProviderManifestToken)


Ralf Kaiser


i have a configuration where i use MS SQL Server 2008 Express on the
development machine and MS SQL Server 2005 Express on the real server with
the entity framework.

Whem working with different datatypes (datetimes for example) that can cause
problems because the EF uses the SQL datatype "DateTime2" which is not
supported by the MS SQL Server 2005 Express. I get errors on runtime when
accessing the tables that contain those types.

After a little while of googling i found out that the "*.edmx" files contain
a parameter "ProviderManifestToken" that can be set to "2005" to keep the
data model compatible with MS SQL Server 2005 Express. That works very good,
after a recompile of the application the errors are gone. Fine.

However, every time i refresh the data model form the database (tables
added/changed) VS changes "ProviderManifestToken" back to its original value
"2008". So if i forget to edit this value before publishing the application
i will have the runtime error back. Sigh.

Is there any way to set "ProviderManifestToken" to a FIXED value that VS
will not touch when refreshing the data model?

Thanks in advance,

Gregory A. Beamer \(Cowboy\) - MVP

None that I know of. This is an attribute that gets set in the SSDL. You can
create a VS addin that turns all SSDL files to the 2005 setting.

Unfortunately, I do not know a way to set this at runtime, as the classes
generated are done automagically behind the scenes.

Gregory A. Beamer

Subscribe to my blog

or just read it:

| Think outside the box! |

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question