dotConnect for Oracle Documentation
Entity Framework Data Type Mapping
support@devart.com

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) bool Boolean System.Boolean
NUMBER(2)..NUMBER(9)2 int Int32 System.Int32
NUMBER(10)..NUMBER(18)2 int64 Int64 System.Int64
NUMBER (p, s), where 0 < s < p < 162 double Double System.Double
other NUMBERs decimal Decimal System.Decimal
FLOAT, REAL, BINARY_FLOAT3, BINARY_DOUBLE3 the same3 Decimal System.Decimal
DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE, TIMESTAMP WITH LOCAL TIME ZONE the same4 DateTime System.DateTime
INTERVAL DAY TO SECOND the same4 Time System.TimeSpan
CHAR, NCHAR, VARCHAR2, NVARCHAR2, CLOB, NCLOB, ROWID, UROWID, XMLTYPE, INTERVAL YEAR TO MONTH, LONG5 the same4 String System.String
BLOB, RAW6, LONG RAW5 the same4 Binary System.Byte[]
PL/SQL BOOLEAN the same4 Boolean System.Boolean
RAW(16) guid Guid System.Guid
PL/SQL BOOLEAN the same4 Boolean System.Boolean
SDO_GEOMETRY7 sdo_geometry4 Geometry, GeometryCollection, GeometryLineString, GeometryMultiLineString, GeometryMultiPoint, GeometryMultiPolygon, GeometryPoint, GeometryPolygon DbGeometry
SDO_GEOMETRY7 sdo_geography4 Geography, GeographyCollection, GeographyLineString, GeographyMultiLineString, GeographyMultiPoint, GeographyMultiPolygon, GeographyPoint, GeographyPolygon DbGeography

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.Boolean Boolean bool NUMBER(1)
System.Byte Byte byte NUMBER(3)2
System.Byte[] Binary BLOB BLOB
DbGeometry3 Geometry sdo_geometry SDO_GEOMETRY
DbGeography3 Geography sdo_geography SDO_GEOMETRY
System.DateTime DateTime TIMESTAMP TIMESTAMP
System.DateTimeOffset DateTimeOffset datetimeoffset TIMESTAMP WITH TIME ZONE
System.Decimal Decimal decimal NUMBER4
System.Double Double double NUMBER
System.Guid Guid guid RAW(16)
System.Int16 Int16 int16 NUMBER(5)2
System.Int32 Int32 int NUMBER(10)2
System.Int64 Int64 int64 NUMBER(19)2
System.SByte SByte sbyte NUMBER(3)2
System.Single Single single NUMBER(15,5)2
System.String String VARCHAR2 VARCHAR2
System.TimeSpan Time INTERVAL DAY TO SECOND INTERVAL 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.