Multiple SQL Server versions in a single ASP.NET application utilizing Entity Framework

entity entity-framework sql-server-2000 sql-server-2005

Question

In a web application that makes use of SQL server 2000, 2005, and 2008, I'm utilizing the Entity Framework. I got an error message when I create a new EDMX file with anything other than 2008 (the version of the first edmx produced).error 0172: All SSDL artifacts must target the same provider. The Provider 'MyDatabase' is different from ' MyDatabase ' that was encountered earlier. When checking the SSDL file and seeing a different ProviderManifestToken value, it seems that somewhere in the code the connection is hooked to a 2008 datastore, which causes it to give this issue. A bit more than annoyed, really. It seems unlikely that EF will only function with a single SQL Server version for each application. There must be a setting or solution, I'm quite sure. Is there a way to utilize various SQL Server and Entity Framework versions in a same web application?

1
11
10/6/2016 5:22:16 PM

Accepted Answer

I was successful in doing this by placing eachedmx in an independent assembly. then swap out all of the in the connection string.res://*/... with res://NameOfAssembly/...

In fact, I can combine the two entity models together (contrary to assertions I saw in other sources), for example:

var oneDb = new Entities2000();
var otherDb = new Entities2005();

var results = from one in oneDb.SomeSet
              join other in otherDb.OtherSet
                  on one.Property equals other.Property
              select new { 
                  SomeProp = one.SomeProp,
                  OtherProp = other.OtherProp 
              };
24
10/16/2009 4:55:58 PM

Popular Answer

When there was a discrepancy between SQL Server 2005 and 2008, this website assisted me in solving the issue. http://kkryczka.wordpress.com/2011/01/03/all-ssdl-artifacts-must-target-the-same-provider-the-providermanifesttoken-2008-is-different-from-2005-that-was-encountered-earlier/

Open with XML Editor may be chosen with a right-click on the.edmx file. .edmx file for Open Entity Framework:

Put 2008 in the ProviderManifestToken:

It seems to be a Microsoft problem.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow