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

$value requires that the key parameter be called 'key' in order to bind the value at runtime #1582

Open
hippiehunter opened this issue Aug 20, 2018 · 0 comments

Comments

@hippiehunter
Copy link

Assemblies affected

Microsoft.AspNetCore.OData 7.0.1

Reproduce steps

add the following code to the bottom of the movies controller in samples\AspNetCoreODataSample.Web\

public string GetTitle(int SomeKindOfKey)
{
    var thing = _context.Movies.FirstOrDefault(c => c.ID == SomeKindOfKey);
    return thing?.Title;
}

Run the project, navigate to http://localhost:5913/efcore/Movies(1)/Title/$value

Expected result

should return "Conan" in raw form without the quotes

Actual result

null reference because SomeKindOfKey was 0 instead of 1

Additional detail

Its weird that this doesn't have any trouble until adding $value on the end, changing the parameter name to key causes everything to work, but what do I do with a composite key, I cant name both parameters key.

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

1 participant