Quantcast
Channel: Bates ITS
Viewing all articles
Browse latest Browse all 9

Cannot load ‘Model.edmx’: Specified cast is not valid.

$
0
0

I recently updated to Visual Studio 2013 Update 2 and upgraded an older Entity Framework 5 project to Entity Framework 6.1. After opening the .edmx file in the recently upgraded project, I received the following error message:

Cannot load ‘MyModel.edmx’: Specified cast is not valid.

After searching online I found a workaround that solved my problem. I had to open up the .edmx manually and make sure that all of the Function and FunctionImport elements that had decimal parameters also included precision and scale information. For example:

<Parameter Name=”Price” Type=”decimal” Mode=”In” />

Had to be changed to

<Parameter Name=”Price” Type=”decimal” Mode=”In” Precision=”18″ Scale=”10″ />

The full details of the workaround can be found various places on the web, including here. What the workarounds do not mention is that in addition to modifying the parameter elements of the Function elements, you may also need to perform the same changes for the parameter elements in the FunctionImport elements.

 

The post Cannot load ‘Model.edmx’: Specified cast is not valid. appeared first on Bates ITS.


Viewing all articles
Browse latest Browse all 9

Trending Articles