Manually Creating an OData feed in Asp.Net Core, Using feed in Power BI

ⅰ亾dé卋堺 提交于 2019-12-12 18:23:28

问题


I am trying to manually write a Web Api that will serve as an OData feed. I don't need much functionality, just the ability to export data stored within Entity framework to an application such as Power BI. I only need to be able to view, so I was planning on just implementing GET requests.

I currently have a standard web api that returns back properly formatted JSON, but I am having trouble formatting this into something that I can import into Power BI as an OData Feed.

Here's a gist of what I have.

public class Report
{
    public string ID { get; set; }
    public string Name { get; set; }
    public string UserID { get; set; }
    ...
}


[Route("api/[controller]")]
public class ReportController : Controller
{
    ...
    [HttpGet("GetReports/{userID}")]
    public IEnumerable<Report> GetReportsByUser(string userID)
    {
        return GetAllReportsByUser(userID); 
    }
    ...
}

I need something like this to work (obviously won't in the current form)


回答1:


Since you are using ASP.NET Core 1 (aka ASP.NET 5), use the OData vNext package to build your OData service. There is a sample service on Github.



来源:https://stackoverflow.com/questions/36670596/manually-creating-an-odata-feed-in-asp-net-core-using-feed-in-power-bi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!