Code convention used for parameters in controller methods inconsistent with Entity Framework Code Convention
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 505
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
By convention, key should be used as method parameter in Controller :
Current
[EnableQuery]
public IActionResult Get(int key)
{
return Ok(_context.Entities.FirstOrDefault(entity => entity.Id == key));
}
Response

Improvement
Support the use of Id as a parameter in controller methods to ensure consistency between System.ComponentModel.DataAnnotations and Microsoft.AspNetCore.OData.
See Entity Framework Core Code Convention and #152
Therefore, the below method should produce the same results as in the response above.
[EnableQuery]
public IActionResult Get(int id)
{
return Ok(_context.Entities.FirstOrDefault(entity => entity.Id == id));
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the controller method parameter handling in Microsoft.AspNetCore.OData and review the behavior described in #152. Verify that a controller action using Get(int id) produces the same response as the equivalent Get(int key) action; the issue does not name specific files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100