1 Reply Latest reply: Oct 5, 2012 7:11 AM by Tridus RSS

    Problem Entity framework and short types

    854983
      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?

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

          <oracle.dataaccess.client>
          <settings>
          <add name="int16" value="edmmapping number(4,0)" />
          <add name="int32" value="edmmapping number(9,0)" />
          </settings>
          </oracle.dataaccess.client>

          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