You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Custom Serializer ODataProperty DateTime ODataPrimitiveValue can only wrap values which can be represented as primitive EDM types.' #1945
var dateTime = DateTime.Now;
new ODataProperty() { Name = "UtcStart", Value = dateTime}
Expected result
Accept DateTime as a valid object, like DateTimeOffset is:
var dateTime = DateTime.Now;
new ODataProperty() { Name = "UtcStart", Value = new DateTimeOffset(dateTime, TimeSpan.Zero) }
Actual result
Microsoft.OData.ODataException: 'An ODataPrimitiveValue was instantiated with a value of type 'System.DateTime'. ODataPrimitiveValue can only wrap values which can be represented as primitive EDM types.'
Additional detail
Optional, details of the root cause if known. Delete this section if you have no additional details to add.
Activity
xuzhg commentedon Nov 6, 2019
@rossbuggins DateTime is removed from OData built-in primitive type. Can you change to use "DateTimeOffset"?