手动创建在Asp.Net核心OData源,在电力BI使用饲料 [英] Manually Creating an OData feed in Asp.Net Core, Using feed in Power BI
问题描述
我想手动编写一个Web的API,将作为一个OData源。我并不需要太多的功能,只是存储实体框架内的数据导出到一个应用程序,如Power BI的能力。我只需要能够查看,所以我打算只实现GET请求。
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.
我现在有一个返回回格式正确的JSON标准的Web API,但是我无法格式化成东西,我可以导入BI电源作为一个OData源这一点。
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);
}
...
}
推荐答案
由于您使用ASP.NET核心1(又名ASP.NET 5),使用的 OData的vNext包来建立你的OData服务。有在Github上一个示例服务
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.
这篇关于手动创建在Asp.Net核心OData源,在电力BI使用饲料的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!