且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用ASP.NET Web Api将对象作为参数传递给OData Action?

更新时间:2023-02-16 13:48:35

假设您将操作绑定到实体类型,则可以使用

Assuming that you bind an action to an Entity type this works

builder.EntityType<company>().Action("SetCommunities").CollectionEntityParameter<community>("communities");
public async Task<IHttpActionResult> SetCommunities(Guid key, ODataActionParameters parameters)

在这种情况下,例如 http://localhost:63358/odata/公司(451735ef-15f2-4a9f-b4b9-d50c6410bf7c)/Default.SetCommunities/