我收到此错误:ODataUnrecognizedPathException:找不到段'sample'的资源。
控制器代码是这样的:
[Produces("application/json")]
[Route("api/Sample")]
public class SampleController : Controller
{
private readonly ISampleBusiness business;
public SampleController(ISampleBusiness _business)
{
business = _business;
}
// GET: api/Sample
[HttpGet]
[EnableQuery]
public async Task<IQueryable<ISGUserDTO>> Get()
{
var data = await business.GetAll();
return data.Data;
}
和
启动代码如下:
public void ConfigureServices(IServiceCollection services)
{
services.AddOData<ISampleBusiness>(builder => builder.EntitySet<Business.Contracts.DTO.Infra.ISGUserDTO>("Sample"));
像这样配置:
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseOData("api");
任何想法有什么不对?