Home Dashboard Directory Help
Search

Bug passing Edm.Int64 data type to Microsoft.Data.OData EntitySetController Action by Mark at Peak Security


Status: 

Closed
 as Not Reproducible Help for as Not Reproducible


1
0
Sign in
to vote
Type: Bug
ID: 780892
Opened: 3/7/2013 1:08:26 AM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

Hello,
I think I have found a bug in the hadling of Edm.Int64 type numbers with regard to Actions assigned to an EntitySetController.

The sitution is that I'm passing in a 64 bit identity with the appended L to indicate that it's an Edm.Int64 number. This is being passed to the OData routing for an Action. The URL is thus:

http://server/ServicePath/EntityName(10020304L)/ActionName

The exception message I'm getting is:

The parameters dictionary contains a null entry for parameter 'key' of non-nullable type 'System.Int64' for method 'MyDomain.Domain.EntityName ActionName(Int64)' in 'MyDomain.Controllers.EntityNameController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.

Per section 6 of the OData refernce site (Primitive Data Types), it would seem to indicate that the Edm.Int64 type should have a appended 'L' character in order to indicate that it is an Edm.Int64 value.

The manual I looked at is here:

http://www.odata.org/developers/protocols/overview#AbstractTypeSystem

This seems to be inconsistant in the other URL line deseralizers, meaning that if I use a URL like:

http://server/ServicePath/EntityName(123456L)

It will return the record as anticipated.

I suspect that this is a parsing issue in the Action routing code.

Thank you!
-Mark.

Details
Sign in to post a comment.
Posted by Microsoft on 3/13/2013 at 12:19 PM
I don't see any other attributes like [FromODataUri]. However, you need to be careful when generating odata link with keys. You should use ODataUriUtils.ConvertToUriLiteral to convert the key value to a odata uri literal by yourself. Follow the sample code we published at: http://aspnet.codeplex.com/SourceControl/changeset/view/75a56ec99968#Samples/WebApi/ODataServiceSample/ReadMe.txt
Posted by Mark at Peak Security on 3/13/2013 at 12:18 AM
That works perfectly! I didn't see this in any of the documentation, sorry for the inconvenience.

For clarification, the right way to ask the EntitySetController to parse the Uri line with Edm data types is by adding the decorative attribute. Are there any other specific cases that this sort of thing applies? Is there a map of the decorative attributes and when they should be applied in OData specific implementations? This would be very helpful. Thanks for all the great work on this product and you are appreciated!
Posted by Microsoft on 3/12/2013 at 5:50 PM
The key should be decorated with a [FromODataUri] attribute. Example: MyDomain.Domain.EntityName.Domain.EntityName ActionName([FromODataUri]Int64)

Can you please verify if its works after the above change and let us know soon? Thanks
Posted by Microsoft on 3/12/2013 at 5:49 PM
The key should be decorated with a [FromODataUri] attribute. Example:
MyDomain.Domain.EntityName.Domain.EntityName ActionName([FromODataUri]Int64)
Posted by Microsoft on 3/11/2013 at 2:01 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 3/8/2013 at 10:52 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.