0
我有兩個OData的服務(m:DataServiceVersion="2.0"
):
- AACUSTOMERS10M:爲客戶提供服務,
- AATRANSACTIONS10M:服務客戶交易
它們之間的關係1..*
在<NavigationProperty>
定義。
我如何才能$count
所有客戶與給定FIRSTNAME
和至少一個交易與給定TRANSACTION_NAME
?
到目前爲止,我試圖(爲一行):
http://.../AACUSTOMERS10M?
$count
&$expand=TRANSACTIONS
&$filter=FIRSTNAME%20%27Maria%27%20
and%20TRANSACTIONS/TRANSACTION_NAME%20%27New%27
但我得到的錯誤
"Illegal query syntax. Segment before '/' is not an entity or complex type."
/$元:
<EntityType Name="AACUSTOMERS10MType">
<Key>
<PropertyRef Name="ID"/>
</Key>
<Property Name="ID" Type="Edm.Int32" Nullable="false"/>
<Property Name="FIRSTNAME" Type="Edm.String" DefaultValue="" MaxLength="100"/>
<Property Name="LASTNAME" Type="Edm.String" DefaultValue="" MaxLength="100"/>
<Property Name="STREET" Type="Edm.String" DefaultValue="" MaxLength="100"/>
<Property Name="ZIP" Type="Edm.String" DefaultValue="" MaxLength="100"/>
<Property Name="CITY" Type="Edm.String" DefaultValue="" MaxLength="100"/>
<Property Name="GENDERNAME" Type="Edm.String" DefaultValue="" MaxLength="100"/>
<Property Name="AGE" Type="Edm.Byte"/>
<Property Name="PROFESSIONNAME" Type="Edm.String" DefaultValue="" MaxLength="100"/>
<Property Name="MARITALSTATUSNAME" Type="Edm.String" DefaultValue="" MaxLength="100"/>
<Property Name="INCOMENAME" Type="Edm.String" DefaultValue="" MaxLength="100"/>
<NavigationProperty Name="TRANSACTIONS" Relationship="myTestPack.oData.artificial.CUSTOMER_TRANSACTIONSType" FromRole="AACUSTOMERS10MPrincipal" ToRole="AATRANSACTIONS10MDependent"/>
</EntityType>
<EntityType Name="AATRANSACTIONS10MType">
<Key>
<PropertyRef Name="ID"/>
<PropertyRef Name="CONTRACTNUMBER"/>
<PropertyRef Name="TRANSACTIONDATE"/>
</Key>
<Property Name="ID" Type="Edm.Int32" Nullable="false"/>
<Property Name="CONTRACTNUMBER" Type="Edm.Int32" Nullable="false"/>
<Property Name="GESCHAEFTSFELD" Type="Edm.String" MaxLength="100"/>
<Property Name="BEREICH" Type="Edm.String" MaxLength="100"/>
<Property Name="AGENT_NAME" Type="Edm.String" MaxLength="201"/>
<Property Name="TRANSACTIONDATE" Type="Edm.DateTime" Nullable="false"/>
<Property Name="TRANSACTION_NAME" Type="Edm.String" MaxLength="100"/>
<Property Name="ENDDATE" Type="Edm.DateTime"/>
<Property Name="DEPOSITVALUE" Type="Edm.Double"/>
<Property Name="MONTHLYFEE" Type="Edm.Double"/>
<Property Name="DELTA" Type="Edm.Double"/>
<NavigationProperty Name="TRANSACTIONS" Relationship="myTestPack.oData.artificial.CUSTOMER_TRANSACTIONSType" FromRole="AATRANSACTIONS10MDependent" ToRole="AACUSTOMERS10MPrincipal"/>
</EntityType>
<Association Name="CUSTOMER_TRANSACTIONSType">
<End Type="myTestPack.oData.artificial.AACUSTOMERS10MType" Role="AACUSTOMERS10MPrincipal" Multiplicity="1"/>
<End Type="myTestPack.oData.artificial.AATRANSACTIONS10MType" Role="AATRANSACTIONS10MDependent" Multiplicity="*"/>
</Association>
對於需要使用 「任何」 或 「全部」 的集合。例如; filter = FIRSTNAME eq'Maria'和TRANSACTIONS/any(tx:tx/NAME eq'New') –
謝謝。但是,這給出了相同的錯誤... – Benvorth