.net core .Net Core 3.1中的OData路由/路径问题
我开始使用OData,但不知道路由和路径是如何工作的 有一个控制器:.net core .Net Core 3.1中的OData路由/路径问题,.net-core,odata,.net Core,Odata,我开始使用OData,但不知道路由和路径是如何工作的 有一个控制器: [Route("odata/[controller]")] public class TestController : ODataController { public TestController(IRepository<ETest> testContext) { _testContext = testContext; } [HttpGet] [Enabl
[Route("odata/[controller]")]
public class TestController : ODataController
{
public TestController(IRepository<ETest> testContext)
{
_testContext = testContext;
}
[HttpGet]
[EnableQuery()]
public IQueryable Get()
{
return _testContext.GetData();
}
[HttpGet]
[EnableQuery()]
public async Task<ETtest> Get([FromQuery] DateTime key)
{
return await _testContext.Get(key);
}
private IRepository<Etest> _testContext { get; }
}
我犯了一个错误:
Microsoft.AspNetCore.Mvc.Infrastructure.AmbiguousActionException: Multiple actions matched. The following actions matched route data and had all constraints satisfied..
如何解决路由问题
是否可以将方法Get重命名为其他名称
我调查了资源:
谢谢您的帮助。将第二个HttpGet更改为
[HttpGet("{key}")]
将第二个HttpGet更改为
[HttpGet("{key}")]
get方法上似乎缺少筛选参数。get方法上似乎缺少筛选参数。