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

Find by ID Failure #39

Closed
nasali opened this issue Oct 24, 2013 · 6 comments
Closed

Find by ID Failure #39

nasali opened this issue Oct 24, 2013 · 6 comments
Assignees

Comments

@nasali
Copy link
Contributor

nasali commented Oct 24, 2013

Executing a find by id query like so svc.Products(4) fails if the Product's mapping is of type Long on the server side.

$metadata snippet looks like this:

<Key>
  <PropertyRef Name="id"/>
</Key>
<Property xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation" Name="id" Type="Edm.Int64" Nullable="false" p6:StoreGeneratedPattern="Identity"/>

Query seems to fail like so:

RestClient.get "http://server/Service.svc/Products(4)", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate"
# => 400 BadRequest | application/xml 216 bytes

<?xml version="1.0" encoding="utf-8"?>
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
  <m:code />
  <m:message xml:lang="en-US">Bad Request - Error in query syntax.</m:message>
</m:error>

Shouldn't service know to append an "L" after the ID between the parenthesis since the Type is Edm.Int64?

Or is there something I'm missing?

Thank you so much in advance.

@visoft
Copy link
Owner

visoft commented Oct 25, 2013

It doesn't do that, it simply takes in whatever you pass it.

I'm assuming that calling http://server/Service.svc/Products(4L) works as expected?

@nasali
Copy link
Contributor Author

nasali commented Oct 25, 2013

Correct. http://server/Service.svc/Products(4L) works, but it does not when given the ID only.

@visoft
Copy link
Owner

visoft commented Oct 25, 2013

Ok. Unfortunately, I won't have time to fix this for at least a week or so. This is going to require a good bit of work as the current method to handle the call isn't very smart.

@ghost ghost assigned visoft Oct 25, 2013
@visoft
Copy link
Owner

visoft commented Nov 17, 2013

Check out the latest in the develop branch as I merged your pull request and made some improvements.

@nasali
Copy link
Contributor Author

nasali commented Nov 18, 2013

I just tested against the develop branch that has your improvements, and everything worked just fine.

Thank you so much for your help. Much appreciated!

@nasali nasali closed this as completed Nov 18, 2013
@visoft
Copy link
Owner

visoft commented Nov 19, 2013

Released (v0.1.5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants