Send feedback on this topic.
Teradata.Client.Provider
EDM.Time and and Interval Types
.NET Data Provider for Teradata > Developer's Guide > ADO.NET Entity Provider for Teradata > Teradata Implementation Specifics > Working with Parameters in the Entity Provider > EDM.Time and and Interval Types
.NET CORE   This feature is not supported by the .NET Core implementation of the Data Provider.

Edm.Time maps to Time and several Interval Teradata types. When the data of a parameter represents an Interval, the Entity Framework will indicate that the parameter is a EDM.Time. When the Entity Provider is creating a TdParameter it will map parameters that are of type EDM.Time to TdType.Time.

When LINQ to Entities is used in an application the value of the parameter that represents an Interval must be a System.TimeSpan.  The Entity Framework will indicate that the parameter is an EDM.Time in the information that is passed to the Entity Provider.

When Entity Sql is used an application, the EntityParameter object can be used to define any parameters contained in Entity Sql statement. The EntityParameter.Value property can either be set to a System.TimeSpan or to the provider specific type for the interval (i.e. TdIntervalDayToSecond, TdIntervalDay, etc..). The EntityParameter.DbType property must also be set to DbType.Time.

The problem that occurs when a parameter represents an Interval is the Entity Provider cannot use the default TdType mapping (TdType.Time) for EDM.Time. The Data Provider for Teradata is unable to convert an Interval to a TdTime. Therefore, if the parameter represents an Interval and the TdType were set to TdType.Time, the Data Provider for Teradata will throw a TdException that indicates that the Interval cannot be converted to a Time.

To solve this problem, the Entity Provider for Teradata performs special processing when the type of a parameter is EDM.Time. This special processing includes determining if the parameter corresponds to an Interval. This is accomplished by inspecting the operands related to the parameter and determining their Teradata Data Type. If the related operands are Intervals, the parameter is also an Interval. Once the Entity Provider determines that the parameter is an Interval it will set the TdParameter.TdType to TdType.IntervalDayToSecond. TdType.IntervalDayToSecond is specified because the Data Provider can convert any Interval that maps to EDM.Time and System.TimeSpan to an Interval Day To Second representation. The Advanced SQL Engine is also able to implicitly convert data represented as an Interval Day To Second to any Interval type that maps to EDM.Time.

The Entity Provider is able to determine the Teradata type of a parameter under the following scenarios:

See Also

TimeSpan Structure