Mapping Data Types and Functions
- Last Updated: April 16, 2026
- 7 minute read
- ADO.NET
- Documentation
Type Mapping for Database First
In a Database First model, the data provider uses a store-centric type mapping scheme, in which the Oracle (store) type influences the EDM type used when the model is generated. For primitive types such as Boolean and Int32 that do not have an obvious equivalent store type, the data provider maps Oracle types to primitive types based on available facets such as precision and scale. In some cases, pseudo-store types have been added to ensure a successful round trip exchange. For example, number_as_int32 always maps to an Int32, regardless of the precision or scale of the Oracle type.
The following table shows Oracle types are mapped to primitive types used in a Database First model. Some Oracle data types can map to several different EDM types; the default values are shown in italics. If you prefer another type mapping, you can specify it using StoreEdmMappings (see storeEdmMappings).
The columns are defined as follows:
- The Oracle Type column refers to the native type name.
- The Store (SSDL) Type column refers to data types used by the store schema definition language (SSDL) file. The storage metadata schema is a formal description of the database that persists data for an application built on the EDM.
- The PrimitiveTypeKind column refers to the common data primitives used to specify the valid content of properties of entities used in defining EDM applications.
Mapping Oracle Types to EDM Types
| Oracle Type | Store (SSDL) Type | PrimitiveTypeKind |
| BINARY_DOUBLE | binary_double1 | Double |
| BINARY_FLOAT | binary_float1 | Single |
| BLOB | blob | Binary |
| CHAR | char CHAR_as_boolean char_as_byte |
String Boolean Byte |
| CLOB | clob | String |
| DATE | date2 date_as_time | DateTime Time |
| FLOAT | float float_as_double | Decimal Double |
| LONG | long3 | String |
| LONG RAW | long raw3 | Binary |
| NCHAR | nchar nchar_as_boolean | String Boolean |
| NCLOB | nclob | String |
| NUMBER | number (1,0)4 number(2,0)4 number(3<=p<=4,0)4 number(5<=p<=9,0)4 number(10<=p<=18,0)4 number(p, s <>0)4 number(p>18,s)4 number_as_boolean number_as_byte number_as_sbyte number_as_int16 number_as_int32 number_as_int64 number_as_double |
Boolean SByte Int16 Int32 Int64 Decimal Decimal Boolean Byte SByte Int16 Int32 Int64 Double |
| NVARCHAR2 | nvarchar2 nvarchar2_as_boolean | String Boolean |
| RAW | raw(16)5 raw(integer not equal to 16)5 raw_as_boolean raw_as_byte raw_as_guid |
Guid Binary Boolean Byte Guid |
| ROWID | rowid | String |
| TIMESTAMP | timestamp timestamp_as_time | DateTime Time |
| TIMESTAMP WITH LOCAL TIME ZONE | timestamp with local time zone timestamp_as_time | DateTime DateTime |
| TIMESTAMP WITH TIME ZONE | timestamp with time zone | DateTimeOffset |
| VARCHAR2 | varchar2 varchar2_as_boolean | String Boolean |
| XMLTYPE | xmltype | String |
1 Only supported on Oracle 10g and higher.
2 The maximum precision of the EDM DateTime simple type is milliseconds. Because the Oracle data type Date has no notion of milliseconds, round trip integrity cannot be guaranteed.
3 The Oracle documentation strongly discourages the use of the Long and Long Raw data types.
4 Precision and Scale facets are used to determine the default mapping.
5 The MaxLength facet is used to determine the default mapping.
Type Mapping for Model First
The following table shows the model-centric type mapping, where the EDM Simple Types influences the Oracle (store) type used when the database is created. The columns are defined as follows:
- The PrimitiveTypeKind column refers to the common data primitives used to specify the valid content of properties of entities used in defining EDM applications.
- The Property Values Affecting Type Mapping identifies any property values that can affect type mapping.
- The Store (SSDL) column refers to data types used by the store schema definition language (SSDL) file. The storage metadata schema is a formal description of the database that persists data for an application built on the EDM.
- The Oracle Type column refers to the native type name.
Mapping EDM Types to Oracle Types
| PrimitiveTypeKind | Property Values That Affect Type Mapping | Store (SSDL) Type | Oracle Type |
| Binary | Max Length = (1 <= n <= 2000) Fixed Length = False1 | raw | RAW(n) |
| Binary | Max Length = Max | (n > 2000) Fixed Length = False
|
blob | BLOB |
| Boolean | number_as_boolean | NUMBER | |
| Byte | number_as_byte | NUMBER | |
| DateTime | timestamp | TIMESTAMP | |
| DateTimeOffset | timestamp with time zone | TIME WITH TIME ZONE | |
| Decimal | number | NUMBER | |
| Double | binary_decimal | BINARY_DOUBLE | |
| Guid | raw_as_guid | GUID | |
| Int16 | number_as_int16 | NUMBER | |
| Int32 | number_as_int32 | NUMBER | |
| Int64 | number_as_int64 | NUMBER | |
| Sbyte | number_as_sbyte | NUMBER | |
| Single | binary_float | BINARY_FLOAT | |
| String | Max Length = (1 <= n <= 2000) Fixed Length = False Unicode = True |
nvarchar | NVARCHAR(n) |
| String | Max Length = (1 <= n <= 2000 )2 Fixed Length = True Unicode = True |
nchar | NCHAR(n) |
| String | Max Length = (1 <= n <= 4000) Fixed Length = False Unicode = False |
varchar2 | VARCHAR2(n) |
| String | Max Length = (1 <= n <= 4000 )3 Fixed Length = True Unicode = False |
char | CHAR(n) |
| String | Max Length = max | (n > 2000) Fixed Length = False Unicode = True |
nclob | NCLOB |
| String | Max Length = max Fixed Length = True Unicode = True |
nchar | NCHAR(2000) |
| String | Max Length = max | (n > 4000) Fixed Length = False Unicode = False |
clob | CLOB |
| String | Max Length = max Fixed Length = True Unicode = False |
char | CHAR(4000) |
| Time | timestamp_as_time | TIMESTAMP |
1 A value of True results in an error: "Fixed Length Binary values are not supported."
2 A value greater than 2000 results in an error "MaxLength ’nvalue’is not valid. Length must be between ’1’ and ’2000’ for String type.
3 A value greater than 4000 results in an error "MaxLength ’nvalue’is not valid. Length must be between ’1’ and ’4000’ for String type
Type Mapping for Code First
The following table shows the model-centric type mapping, where the CLR type influences the Oracle (store) type used when the database is created. Some CLR types can map to several different Oracle types; the default values are shown in italics. If you prefer another type mapping, you can specify it using StoreEdmMappings (see storeEdmMappings).
The columns are defined as follows:
- The CLR Type column refers to the common language runtime type name.
- The Oracle Type column refers to the native type name.
Mapping CLR Types to Oracle Data Types in a Code First Model
| CLR Type | Oracle Data Type |
| Boolean | NUMBER CHAR NCHAR NVARCHAR2 RAW VARCHAR2 |
| Byte | BLOB CHAR LONG RAW1 NUMBER RAW |
| DateTime | DATE2 TIMESTAMP WITH LOCAL TIME ZONE TIMESTAMP |
| DateTimeOffset | TIMESTAMP WITH TIME ZONE |
| Decimal | FLOAT NUMBER |
| Double | Binary_Double FLOAT NUMBER |
| Guid | RAW |
| Int16 | NUMBER |
| Int32 | NUMBER |
| Int64 | NUMBER |
| Sbyte | NUMBER |
| Single | BINARY_FLOAT |
| String | CHAR CLOB LONG1 NCHAR NCLOB NVARCHAR ROWID VARCHAR2 XMLTYPE |
| TimeSpan | DATE TIMESTAMP WITH LOCAL TIME ZONE TIMESTAMP |
1 The Oracle documentation strongly discourages the use of the Long Raw data type.
2 The maximum precision of the EDM DateTime simple type is milliseconds. Because the Oracle data type Date has no concept of milliseconds, round trip integrity cannot be guaranteed.
Mapping EDM Canonical Functions to Oracle Functions
The ADO.NET Entity Framework translates the Entity Data Model (EDM) canonical functions to the corresponding data source functionality for the ADO.NET Oracle Entity data provider. The function invocations are expressed in a common form across data sources.
Because these canonical functions are independent of data sources, argument and return types of canonical functions are defined in terms of types in the EDM. When an Entity SQL query uses canonical functions, the appropriate function is called at the data source.
Both null-input behavior and error conditions are explicitly specified for all canonical functions. However, the ADO.NET Entity Framework does not enforce this behavior. Further details are available at:
https://msdn.microsoft.com/en-us/library/bb738626.aspx
Aggregate Canonical Functions
The following table describes the mapping of EDM aggregate canonical functions to Oracle functions.
Mapping Aggregate Canonical Functions
| Aggregate Canonical Function | Oracle functions |
| Avg(expression) | avg(expression) |
| BigCount(expression) | count(expression) |
| Count(expression) | count(expression) |
| Max(expression) | max(expression) |
| Min(expression) | min(expression) |
| StDev(expression) | stdev_samp(expression) |
| Sum(expression) | sum(expression) |
Math Canonical Functions
The following table describes the mapping of EDM math canonical functions to Oracle functions.
Mapping Math Canonical Functions
| Math Canonical Function | Oracle Function |
| Abs(value) | abs(value) |
| Ceiling(value) | ceil(value) |
| Floor(value) | floor(value) |
| Round(value) | round(value, 0) |
Date and Time Canonical Functions
The following table describes the mapping of EDM date and time canonical functions to Oracle functions.
Mapping Date and Time Canonical Functions
| Date and Time Canonical Function | Oracle Functions |
| Year(expression) | extract(YEAR from expression) |
| Month(expression) | extract(MONTH from expression) |
| Day(expression) | extract(DAY from expression) |
| Hour(expression) | extract(HOUR from expression) |
| Minute(expression) | extract(MINUTE from expression) |
| Second(expression) | extract(SECOND from expression) |
| Millisecond(expression) | Not supported |
| GetTotalOffsetMinutes(DateTime Offset) | Not supported |
| CurrentDateTime | current_date |
| CurrentDateTimeOffset | tz_offset(SESSIONTIMEZONE) + current_date |
| CurrentUtcDateTime | sys_extract_utc |
Bitwise Canonical Functions
The following table describes the mapping of EDM bitwise canonical functions to Oracle functions.
Mapping Bitwise Canonical Functions
| Bitwise Canonical Function | Oracle Functions |
| BitWiseAnd (value1, value2) | bit_and (value1, value2) |
| BitWiseNot (value) | bit_compliment |
| BitWiseOr (value1, value2) | bit_or |
| BitWiseXor (value1, value2) | bit_xor |
String Canonical Functions
The following table describes the mapping of EDM string canonical functions to Oracle functions.
Mapping String Canonical Functions
| String Canonical Function | Oracle Function |
| Concat(string1, string2) | concat(string1, string2) |
| IndexOf(target, string2) | instr(target, string2) |
| Left(string1, length) | Not supported |
| Length(string) | length(string) |
| LTrim(string) | ltrim(string) |
| Trim(string) | trim (BOTH FROM string) |
| Replace(string1, string2, string3) | replace(string1, string2, string3) |
| Reverse(string) | Not supported |
| RTrim(string) | rtrim(string) |
| Substring(string, start, length) | INCOMPLETE regexpr_substr(…) |
| ToLower(string) | lower(string) |
| ToUpper(string) | upper(string) |