Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在建模 OData 服务时遇到了一些问题。我的要求是,我想通过单个值和/或范围的列表来查询实体集。示例:给我实体集中 ID 为 3、6、8、14 到 20 或 35 到 77 之间的所有实体。
怎么可能建模?我想到了函数导入,但我不确定是否可以将实体集(=值/范围列表)用作参数!?
在此先感谢您的帮助!
您应该能够使用 OData 的内置过滤机制,即$filter查询字符串参数来执行此操作。
$filter
例如,请求 URI 看起来像这样:
http://.../MyService.svc/EntitySet?$filter=ID eq 3 or ID eq 6 or ID eq 8 or (ID ge 14 and ID le 20) or (ID ge 35 and ID le 77)