本文介绍了筛选OData中的扩展实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在OData中的扩展实体上应用过滤条件?
How to apply filtering conditions on expanded entities in OData ?
假设我的主实体为具有字段的home
Suppose I have master entity as home
having fields
homeId, StateId, CountyID, Address
和子实体state
as
StateId, StateName
和county
为
CountyID, CountyName
我需要获取带有州名和县名的过滤条件的家庭住址和ID.网址应该如何?
I need to get the home addresses and Ids with a filter condition with state name and county name. How should be the url?
推荐答案
使用$ expand关键字OData查询应该类似于:
Using the $expand keyword OData query should be something like:
/home/?$ filter =州/州名称eq'STATE'和县/县名eq'COUNTY'& $ expand = state,county& $ select = homeId,地址
/home/?$filter=state/statename eq 'STATE' and county/countyname eq 'COUNTY'&$expand=state,county&$select=homeId, Address
这篇关于筛选OData中的扩展实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!