[英]Azure Mobile Apps - Overriding the QueryAsync method with custom code in Table Controller
I would like to override the Query Async Method with some Custom code, so I can access an external api, get some data and then use this data to query the db tables to get the results, this should support all the default sync and paging features provided by the base method.我想用一些自定义代码覆盖查询异步方法,这样我就可以访问外部 api,获取一些数据,然后使用这些数据查询数据库表以获得结果,这应该支持所有默认的同步和分页功能由基本方法提供。 I'm using the latest 5.0 DataSync library.
我正在使用最新的 5.0 DataSync 库。 Old versions returned a IQueryable so this was easy to do, but now it returns an action result.
旧版本返回一个 IQueryable,所以这很容易做到,但现在它返回一个操作结果。 Is there any solution?
有什么解决办法吗? Could not find any docs.
找不到任何文档。
eg I get a set of guids from api. I query the db tables with these guids and get all the matching rows and return back to client.例如,我从 api 获得了一组 guid。我使用这些 guid 查询数据库表并获取所有匹配的行并返回给客户端。
I know how to override the method, call external api's, get data and query the db tables, but this provides me with a custom data format not the one that the query async gives by default with paging support.我知道如何覆盖该方法、调用外部 api、获取数据和查询数据库表,但这为我提供了一种自定义数据格式,而不是查询异步默认提供的具有分页支持的格式。
The way to accomplish this is to create a new repository, swapping out the various CRUD elements with your own implementation.实现这一点的方法是创建一个新的存储库,用您自己的实现替换各种 CRUD 元素。 You can use the EntityTableRepository as an example.
您可以使用 EntityTableRepository 作为示例。 You will note that the "list" operation just returns an IQueryable, so you can do what you need to do and then return the updated IQueryable.
你会注意到“列表”操作只返回一个 IQueryable,所以你可以做你需要做的,然后返回更新后的 IQueryable。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.