如何在 .net 核心应用程序中使用 OData? [英] How is it possible to use OData in .net core application?

查看:27
本文介绍了如何在 .net 核心应用程序中使用 OData?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据文档(http://odata.github.io/WebApi/#11-01-OData-V4-Web-API-Scaffolding) 需要从 ODataController 继承.我已经使用 nuget 安装了包,但仍然无法从该类继承.OData 是否支持 .net 核心?文档过时了吗?

According to docs (http://odata.github.io/WebApi/#11-01-OData-V4-Web-API-Scaffolding) it is required to inherit from ODataController. I have installed package using nuget and still not able to inherit from that class. Does OData support .net core? Are docs obsolete?

推荐答案

ASP.net 核心中的 OData 支持

您提到的文档链接针对 .NET Framework.对于 .NET Core 支持,请从

The docs link that you mentioned is targeting .NET Framework. For .NET Core support, please download the Microsoft.AspNetCore.OData NuGet Package from

https://www.nuget.org/packages/Microsoft.AspNetCore.OData

这个包依赖于 Microsoft.OData.Core,它也会自动安装.从版本 7.2.0 开始,该包面向 .NET Standard 1.1.

This package has a dependency on Microsoft.OData.Core which will also get installed automatically. Starting from version 7.2.0 the package is targeting .NET Standard 1.1.

一旦包被引用,您应该能够从 ODataController 继承.更多详情请参考以下视频和链接

Once the package is referenced, You should be able to inherit from ODataController. For further details please refer to the following video and links

https://www.towfeek.se/2017/01/08/odata-with-aspnet-core/

http://odata.github.io/odata.net/v7/#ODL-7.3.1

希望能帮到你

这篇关于如何在 .net 核心应用程序中使用 OData?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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