在 Asp.Net Core 中手动创建 OData 提要,在 Power BI 中使用提要 [英] Manually Creating an OData feed in Asp.Net Core, Using feed in Power BI

查看:16
本文介绍了在 Asp.Net Core 中手动创建 OData 提要,在 Power BI 中使用提要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试手动编写一个用作 OData 提要的 Web Api.我不需要太多功能,只需能够将存储在实体框架中的数据导出到 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.

我目前有一个标准 Web api,它返回格式正确的 JSON,但我无法将其格式化为可以作为 OData Feed 导入 Power BI 的内容.

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.

这是我所拥有的要点.

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)

推荐答案

由于您使用的是 ASP.NET Core 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 Core 中手动创建 OData 提要,在 Power BI 中使用提要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆