dotConnect for Oraclesupport@devart.com

Entity Framework Data Type Mapping

Oracle to .NET type mapping

Type mapping rules from this table are used by default when generating a model from a database with Entity Data Model Wizard in Visual Studio 2008 - 2015 and Create Model Wizard in Entity Developer.

You may override the default mapping for numeric types in Entity Data Model Wizard using the OracleConnection.NumberMappings property.

Oracle data types

SSDL1

CSDL1

.NET

NUMBER(1)boolBooleanSystem.Boolean
NUMBER(2)..NUMBER(9)2intInt32System.Int32
NUMBER(10)..NUMBER(18)2int64Int64System.Int64
NUMBER (p, s), where 0 < s < p < 162doubleDoubleSystem.Double
other NUMBERsdecimalDecimalSystem.Decimal
FLOAT, REAL, BINARY_FLOAT3, BINARY_DOUBLE3the same3DecimalSystem.Decimal
DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE, TIMESTAMP WITH LOCAL TIME ZONEthe same4DateTimeSystem.DateTime
INTERVAL DAY TO SECONDthe same4TimeSystem.TimeSpan
CHAR, NCHAR, VARCHAR2, NVARCHAR2, CLOB, NCLOB, ROWID, UROWID, XMLTYPE, INTERVAL YEAR TO MONTH, LONG5the same4StringSystem.String
BLOB, RAW6, LONG RAW5the same4BinarySystem.Byte[]
PL/SQL BOOLEANthe same4BooleanSystem.Boolean
RAW(16)guidGuidSystem.Guid
PL/SQL BOOLEANthe same4BooleanSystem.Boolean
SDO_GEOMETRY7sdo_geometry4Geometry, GeometryCollection, GeometryLineString, GeometryMultiLineString, GeometryMultiPoint, GeometryMultiPolygon, GeometryPoint, GeometryPolygonDbGeometry
SDO_GEOMETRY7sdo_geography4Geography, GeographyCollection, GeographyLineString, GeographyMultiLineString, GeographyMultiPoint, GeographyMultiPolygon, GeographyPoint, GeographyPolygonDbGeography

1 Applicable only to Entity Framework v1 - v6. Not applicable to Entity Framework Core, because Entity Framework Core does not support XML mapping.

2 The negative scale cases are taken into account.

3 BINARY_DOUBLE and BINARY_FLOAT data types appeared in Oracle 10g.

4 These SSDL types completely identical to the corresponding Oracle data types.

5 According to official Oracle recomendations, using of LONG and LONG RAW data types is not recommended.

6 All RAW types, except RAW(16).

7 Supported in Entity Framework v5 and v6.

.NET to Oracle default type mapping

.NET

CSDL1

SSDL1

Oracle data types

System.BooleanBooleanboolNUMBER(1)
System.ByteBytebyteNUMBER(3)2
System.Byte[]BinaryBLOBBLOB
DbGeometry3Geometrysdo_geometrySDO_GEOMETRY
DbGeography3Geographysdo_geographySDO_GEOMETRY
System.DateTimeDateTimeTIMESTAMPTIMESTAMP
System.DateTimeOffsetDateTimeOffsetdatetimeoffsetTIMESTAMP WITH TIME ZONE
System.DecimalDecimaldecimalNUMBER4
System.DoubleDoubledoubleNUMBER
System.GuidGuidguidRAW(16)
System.Int16Int16int16NUMBER(5)2
System.Int32Int32intNUMBER(10)2
System.Int64Int64int64NUMBER(19)2
System.SByteSBytesbyteNUMBER(3)2
System.SingleSinglesingleNUMBER(15,5)2
System.StringStringVARCHAR2VARCHAR2
System.TimeSpanTimeINTERVAL DAY TO SECONDINTERVAL DAY TO SECOND

1 Applicable only to Entity Framework v1 - v6. Not applicable to Entity Framework Core, because Entity Framework Core does not support XML mapping.

2 Note that when mapping corresponding database data type, you will need the .NET type with larger precision. That is because, for example, any Int32 value can be stored in the NUMBER(10) column, but largest NUMBER(10) column value cannot be stored in the Int32 field, it requires Int64 field.

3 Supported in Entity Framework v5 and v6.

4 Mapping of this type depends on the DecimalPropertyConvention. If this convention is enabled (it is enabled by default), System.Decimal is mapped to NUMBER(18,2). Otherwise, it is mapped to NUMBER.

 

 


© 2002 - 2016 Devart. All rights reserved.