Skip to main content

Temporal Types

When using the Microsoft.Restier.Providers.EntityFramework provider, temporal types are now supported. The table below shows how Temporal Types map to SQL Types: The next sections illustrate how to use use temporal types in various scenarios.

Edm.DateTimeOffset

Suppose you have an entity class Person, all the following code define Edm.DateTimeOffset properties in the EDM model though the underlying SQL types are different (see the value of the TypeName property). You can see Column attribute is optional here.

Edm.Date

The following code define an Edm.Date property in the EDM model.

Edm.Duration

The following code define an Edm.Duration property in the EDM model.

Edm.TimeOfDay

The following code define an Edm.TimeOfDay property in the EDM model. Please note that you MUST NOT omit the ColumnTypeAttribute on a TimeSpan property otherwise it will be recognized as an Edm.Duration as described above.
As before, if you have the need to override ODataPayloadValueConverter, please now change to override RestierPayloadValueConverter instead in order not to break the payload value conversion specialized for these temporal types.