Entity Database, Map Oracle Database Type Number (10) -.net Int32

A field in an oracle database of type number(10) that is larger than the .net Int32 range. I now use an entity structure to extract data from this table and map it to the database object of this table. But, I got this error when I retrieve the data:

 var competitions = db.PKG_API_PORTAL_SP_GETFBCOMPETITION().ToList(); 

The key field type '' must be "System.Int32", but this value does have the type "System.Int64".

I found this Oracle Data Provider question to map CLR types

and here is an article to explain how this data type was translated http://www.devart.com/dotconnect/oracle/docs/DataTypeMapping.html

But now I need a solution to solve this problem.

+7
oracle entity-framework
source share
2 answers

I assume that since you are using DotConnect for Oracle with EF, you are returning Refcursor from the / SP function that is projected onto the data type.

You have three options for fixing the problem: 1- Change the type in the object that you are mapping to Int64. This is the simplest solution. If you are using a developer entity, just select the type in your mapping, change the type to "int64", click "OK", restore your classes.

2- Change the returned Refcursor to omit the number (10) in the number (9). This is likely to hurt performance and ultimately break something, so I would not recommend it.

0
source share

Each column of type NUMBER (n) represents INT64. "n" acts as a constraint on the table, but all data in it is the same size. You should upgrade to the Int64 type on the client side. Hooray!

0
source share

All Articles