This discussion is archived
4 Replies Latest reply: Sep 28, 2012 9:55 AM by 964795 RSS

Entity Framework mapping Oracle Number type to .NET Double

934596 Newbie
Currently Being Moderated
Is it possible to map an oracle Number(38,0) to an .NET Double? For reasons beyond my control, I need the numbers to be represented as the Double type in my C# objects. I have tried overriding the configuration in app.config as follows:

<oracle.dataaccess.client>
<settings>
<add name="double" value="edmmapping number(38,0)" />
</settings>
</oracle.dataaccess.client>

When my application tries to connect to the database, I get the following error:
Schema specified is not valid:
Member Mapping specified is not valid. The type 'Edm.Double[Nullable=True,DefaultValue=]' of member 'XXX' in type 'Model.XXX' is not compatible with 'OracleEFProvider.number[Nullable=True,DefaultValue=,Precision=38,Scale=0]' of member 'XXX' in type 'Model.Store.XXX'.
  • 1. Re: Entity Framework mapping Oracle Number type to .NET Double
    15208 Explorer
    Currently Being Moderated
    Mapping number(38,0) to .NET Double is not supported.
    BINARY_DOUBLE, available since 10g, is mapped to Edm.Double and .NET Double.
  • 2. Re: Entity Framework mapping Oracle Number type to .NET Double
    DNETFX Newbie
    Currently Being Moderated
    This is a major limitation - some legacy databases I have seen use number for almost everything and change the schema or modifying the model so everything will have decimal instead of double is out of the question.

    Why can't this be overridden in the app.config the way it is for integer types?

    There is less of a chance of overflow with double than with int, if the cast is wrong.

    Is there any way to hack this to get it working (other than using queries with casts instead of tables in EDMX)?

    It is possible to get an update that enables this? (via the app.config or automatically for numbers with default precision) - This is very important to the work I am doing.

    Also, the EDMX won't accept Type="BINARY_DOUBLE" (in the SSDL section)

    Error message:

    The Type BINARY_DOUBLE is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.

    Edit: Type should be in lower case! ("binary_double" not "BINARY_DOUBLE").
  • 3. Re: Entity Framework mapping Oracle Number type to .NET Double
    964795 Newbie
    Currently Being Moderated
    Hi,

    Have you some news ?
    I use EF with the latest ODP.NET and Oracle NUMBER become DECIMAL in Edmx. How to define automatically Oracle NUMBER to Double .NET in the Edmx ?
  • 4. Re: Entity Framework mapping Oracle Number type to .NET Double
    964795 Newbie
    Currently Being Moderated
    I've just download dotconnect by Devart and this provider manages correctly the mapping from Oracle Number to .NET Double.
    Why the ODAC 11.2 Release 5 (11.2.0.3.20) doesn't manage .NET double type ?
    When Oracle will delivered us ODAC with .NET double support ?

    In my edmx I have a Decimal field that comes from a NUMBER in my database.

    .NET double datatype = from ±5.0 × 10E−324 to ±1.7 × 10E308
    .NET decimal datatype = (from -7.9 x 10E28 to 7.9 x 10E28) / (10E(0 to 28))
    Oracle NUMBER = from 10E-84 to 10E127

    How can i put 1.96629648070175438992631578947368421053579 in a .NET decimal ??? > capacity overflow

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points