Search code examples
c#.netoracle-databaseentity-frameworkef-database-first

Entity Framework generates short instead of int


We are using Entity Framework database-first for our Oracle database.

For some reason Number(5) becomes Int16 - short

Max Number(5) value is 99999
Max Int16 value is 32767

Problem... is there a way to instruct the mapper to translate Number(5) to int32?


Solution

  • Solved it, Added this to the web.config:

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

    Recreated the Model with the *.edmx file and...

    Now Number(5) is Int32 instead of Int16 and Number(10) is Int64 instead of Int32

    I hope it'll help someone else in the future...