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/2010/2012 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) | bool | Boolean | System.Boolean |
| NUMBER(2)..NUMBER(9)1 | int | Int32 | System.Int32 |
| NUMBER(10)..NUMBER(18)1 | int64 | Int64 | System.Int64 |
| NUMBER (p, s), where 0 < s < p < 161 | double | Double | System.Double |
| other NUMBERs | decimal | Decimal | System.Decimal |
| FLOAT, REAL, BINARY_FLOAT2, BINARY_DOUBLE2 | the same3 | Decimal | System.Decimal |
| DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE, TIMESTAMP WITH LOCAL TIME ZONE | the same3 | DateTime | System.DateTime |
| INTERVAL DAY TO SECOND | the same3 | Time | System.TimeSpan |
| CHAR, NCHAR, VARCHAR2, NVARCHAR2, CLOB, NCLOB, ROWID, UROWID, XMLTYPE, INTERVAL YEAR TO MONTH, LONG4 | the same3 | String | System.String |
| BLOB, RAW5, LONG RAW4 | the same3 | Binary | System.Byte[] |
| PL/SQL BOOLEAN | the same3 | Boolean | System.Boolean |
| RAW(16) | guid | Guid | System.Guid |
| PL/SQL BOOLEAN | the same3 | Boolean | System.Boolean |
| SDO_GEOMETRY6 | the same3 | Geometry, GeometryCollection, GeometryLineString, GeometryMultiLineString, GeometryMultiPoint, GeometryMultiPolygon, GeometryPoint, GeometryPolygon | System.Data.Spatial.DbGeometry |
| SDO_GEOGRAPHY6 | the same3 | Geography, GeographyCollection, GeographyLineString, GeographyMultiLineString, GeographyMultiPoint, GeographyMultiPolygon, GeographyPoint, GeographyPolygon | System.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 | CSDL | SSDL | Oracle data types |
|---|---|---|---|
| System.Boolean | Boolean | bool | NUMBER(1) |
| System.Byte | Byte | byte | NUMBER(3)1 |
| System.Byte[] | Binary | BLOB | BLOB |
| System.DateTime | DateTime | TIMESTAMP | TIMESTAMP |
| System.DateTimeOffset | DateTimeOffset | datetimeoffset | TIMESTAMP WITH TIME ZONE |
| System.Decimal | Decimal | decimal | NUMBER |
| System.Double | Double | double | NUMBER |
| System.Guid | Guid | guid | RAW(16) |
| System.Int16 | Int16 | int16 | NUMBER(5)1 |
| System.Int32 | Int32 | int | NUMBER(10)1 |
| System.Int64 | Int64 | int64 | NUMBER(19)1 |
| System.SByte | SByte | sbyte | NUMBER(3)1 |
| System.Single | Single | single | NUMBER(15,5)1 |
| System.String | String | VARCHAR2 | VARCHAR2 |
| System.TimeSpan | Time | INTERVAL DAY TO SECOND | INTERVAL 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-2013 Devart. All rights reserved.