OData / OData/AspNetCoreOData

Exception: Request matched multiple endpoints

Open
#154 2 comments 0 reactions 1 assignee View on GitHub

@xuzhg is already working on this.

Since Apr 21, 2021.

investigated
Dominant language
C#
Stars
505
Forks
186
PR merge metrics
No merged PRs in 30d

Description

NugetPackage: Microsoft.AspNetCore.OData -Version 8.0.0-rc

BEFORE

Given I add a Get() method to the controller,
And I start the App
Then the expected response is returned.

Controller

 public class EntitiesController: ODataController
    {
        private Context _context;

        public EntitiesController(Context context)
        {
            _context = context;
        }

        [EnableQuery]
        public IActionResult Get()
        {
            return Ok(_context.Entities);
        }
    }

Response

image

AFTER

Given I add a second Get(int id) method,
And I start the App,
Then an exception is thrown.

Controller

    public class EntitiesController: ODataController
    {
        private Context _context;

        public EntitiesController(Context context)
        {
            _context = context;
        }

        [EnableQuery]
        public IActionResult Get()
        {
            return Ok(_context.Entities);
        }

        [EnableQuery]
        public IActionResult Get(int id)
        {
            return Ok(_context.Entities.FirstOrDefault(entity => entity.Id == id));
        }
    }

Response

image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.