Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Edm.Date as edm:Key #347

SageLukeDean opened this issue Sep 29, 2015 · 2 comments


None yet
4 participants
Copy link

commented Sep 29, 2015


Currently, if an Edm.Date is used as a key field, it is impossible to fetch an individual element because LiteralParser has no parser for Edm.Date.

Minimal repro steps

Define an Entity type that has an Edm.Date as a key field.
Attempt to fetch ~/MyEntity(DateKey=2015-09-28)

Expected result

Date keys should now be supported as per section 8.2 "Element edm:Key" of the Common Schema Definition Language.

Actual result

Microsoft.OData.Core.UriParser.Parsers.LiteralParser Parsers is missing an entry for Edm.Date, so it fails with an exception saying as much.

Further technical details

The SelfLinks generator already supports Edm.Date properly, so we're able to generate links for elements who have Edm.Date as key segments. The Uri parser just fails to parse them.

Adding a PrimitiveParser to LiteralParser.Parsers for Edm.Date fixes the issue and allows me to fetch entities with Edm.Date in the key.
LiteralParser currently uses XmlConvert.ToDateTimeOffset() to parse a string into a DateTime. We can use that same function to parse a string into an Edm.Date.

I can submit a pull request for the modified LiteralParser.cs and a unit test.


This comment has been minimized.

Copy link

commented Oct 8, 2015

@SageLukeDean Thanks your feedback and warmly welcome send us pull request.

SageLukeDean added a commit to SageLukeDean/ that referenced this issue Oct 8, 2015

LianwMS added a commit that referenced this issue Nov 12, 2015

@congysu congysu added this to the 6.14 milestone Nov 27, 2015


This comment has been minimized.

Copy link

commented Nov 30, 2015

Committed and closed

@LianwMS LianwMS closed this Nov 30, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.