Freigeben über


Type Promotability Rules (EDM)

This topic describes the promotability rules that are enforced by the Entity Framework.

Promotability Rules

  • Every type is promotable to itself.

  • A is promotable to S means that type A is promotable to all types in set S.

  • Byte is promotable to Int16, Int32, Int64, Decimal, Single, and Double.

  • Int16 is promotable to Int32, Int64, Decimal, Single, and Double.

  • Int32 is promotable to Int64, Decimal, Single, and Double.

  • Int64 is promotable to Decimal, Single, and Double.

  • Single is promotable to Double.

Explicit Conversions

In the Entity Framework, explicit conversions are always allowed between any two simple types. If the data source provider does not support a particular cast, an exception might be thrown during execution.

The following examples demonstrate casting to EDM types:

cast('6/9/2006' as Edm.DateTime)

cast(2.0 as Edm.Decimal)

See Also

Concepts

.NET Framework Data Provider for SQL Server Types (Entity Framework)