1 Reply Latest reply on Oct 5, 2012 12:11 PM by Tridus

    Problem Entity framework and short types

      I am using the Entity Framework in Visual Studio to access a table in my oracle database. Problem is when selecting a record in runtime the following error shows up:
      Value was either too large or too small for an Int16

      This error originates when trying to access a table-field declared as number(5). The framework translates this in a short field. The max value for short is 32767, but the value in the table is 36001.

      Can I solve this?

        • 1. Re: Problem Entity framework and short types
          Yes, you need to change the mapping for that type to an int32. To do that you can add this to your configuration file:

          <add name="int16" value="edmmapping number(4,0)" />
          <add name="int32" value="edmmapping number(9,0)" />

          You should then update the model to get the new changes. Note that I've found that I have to change the types manually in the model, but after I do that once it works fine. Documentation is here: http://docs.oracle.com/cd/E11882_01/win.112/e18754/featLINQ.htm