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 - 2013 and Create Model Wizard in Entity Developer.

You may override the default mapping for numeric types using the OracleConnection.NumberMappings property.

Oracle data types

SSDL

CSDL

.NET

NUMBER(1)boolBooleanSystem.Boolean
NUMBER(2)..NUMBER(9)1intInt32System.Int32
NUMBER(10)..NUMBER(18)1int64Int64System.Int64
NUMBER (p, s), where 0 < s < p < 161doubleDoubleSystem.Double
other NUMBERsdecimalDecimalSystem.Decimal
FLOAT, REAL, BINARY_FLOAT2, BINARY_DOUBLE2the same3DecimalSystem.Decimal
DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE, TIMESTAMP WITH LOCAL TIME ZONEthe same3DateTimeSystem.DateTime
INTERVAL DAY TO SECONDthe same3TimeSystem.TimeSpan
CHAR, NCHAR, VARCHAR2, NVARCHAR2, CLOB, NCLOB, ROWID, UROWID, XMLTYPE, INTERVAL YEAR TO MONTH, LONG4the same3StringSystem.String
BLOB, RAW5, LONG RAW4the same3BinarySystem.Byte[]
PL/SQL BOOLEANthe same3BooleanSystem.Boolean
RAW(16)guidGuidSystem.Guid
PL/SQL BOOLEANthe same3BooleanSystem.Boolean
SDO_GEOMETRY6the same3Geometry, GeometryCollection, GeometryLineString, GeometryMultiLineString, GeometryMultiPoint, GeometryMultiPolygon, GeometryPoint, GeometryPolygonSystem.Data.Spatial.DbGeometry
SDO_GEOGRAPHY6the same3Geography, GeographyCollection, GeographyLineString, GeographyMultiLineString, GeographyMultiPoint, GeographyMultiPolygon, GeographyPoint, GeographyPolygonSystem.Data.Spatial.DbGeography

1 The negative scale cases are taken into account.

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

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

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

5 All RAW types, except RAW(16).

6 Supported in Entity Framework 5 and higher.

.NET to Oracle default type mapping

.NET

CSDL

SSDL

Oracle data types

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

1 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.

 

 


© 2002 - 2014 Devart. All rights reserved.