Page 1 of 1

Numeric Data Type Mapping for EF Core 3 and Oracle

Posted: Sat 17 Jul 2021 15:45
by nruffing
We are using EF Core 3 against an Oracle database.

We are currently noticing an issue with Entity Developer numeric data type mappings. Currently NUMBER(2,0) is mapping to Int32.

When we change or delete an entity EF Core throws an InvalidCastException because its trying to cast the integer to a byte.

According to this documentation I think Number(2,0) should map to byte by default.
https://docs.oracle.com/en/database/ora ... E7305E3F6A

Here is what appears to be the latest default mapping settings in Entity Developer.
  • Number -> Decimal
  • Number(1,0) -> Boolean
  • Number(2...9,0) -> Int32
  • Number(10...18,0) -> Int64
  • Number(1...15,-84...127) -> Double
We are currently using the latest version of Entity Developer (v6.11.1283).

Re: Numeric Data Type Mapping for EF Core 3 and Oracle

Posted: Mon 19 Jul 2021 11:08
by Shalex
The default type mapping for the Entity Framework feature in dotConnect for Oracle is described at http://www.devart.com/dotconnect/oracle ... pping.html.

The Database First mapping for the newly created models can be customized via Visual Studio > Tools > Entity Developer > Options > Server Options > Oracle. You can map Number(2,0) to byte.