Wcf Can';t根据服务操作结果调用$expand
我有公开“StartAction”服务操作的Odata服务。此操作返回ActionResponse实体Wcf Can';t根据服务操作结果调用$expand,wcf,odata,Wcf,Odata,我有公开“StartAction”服务操作的Odata服务。此操作返回ActionResponse实体 <EntityType Name="ActionResponse"> <Key> <PropertyRef Name="FolderId" /> </Key> <Property Name="FolderId" Type="Edm.String" Nullable="false" />
<EntityType Name="ActionResponse">
<Key>
<PropertyRef Name="FolderId" />
</Key>
<Property Name="FolderId" Type="Edm.String" Nullable="false" />
<Property Name="ClientData" Type="Edm.String" Nullable="true" />
<Property Name="ProcessCaption" Type="Edm.String" Nullable="true" />
<Property Name="ProcessName" Type="Edm.String" Nullable="true" />
<Property Name="ProjectName" Type="Edm.String" Nullable="true" />
<Property Name="ProjectVersion" Type="Edm.Int32" Nullable="false" />
<Property Name="ServerData" Type="Edm.String" Nullable="true" />
<Property Name="StageName" Type="Edm.String" Nullable="true" />
<Property Name="UserName" Type="Edm.String" Nullable="true" />
<NavigationProperty Name="Action" Relationship="Metastorm.EngineData.ActionResponse_Action_Action_ActionResponse" FromRole="ActionResponse_Action" ToRole="Action_ActionResponse" />
</EntityType>
<Association Name="ActionResponse_Action_Action_ActionResponse">
<End Role="ActionResponse_Action" Type="Metastorm.EngineData.ActionResponse" Multiplicity="0..1" />
<End Role="Action_ActionResponse" Type="Metastorm.EngineData.Action" Multiplicity="0..1" />
</Association>
我可以解决它,如果我将返回IQueryable只有一个项目,但它看起来很丑。有人知道如何让$expand为返回单个实体的服务操作工作吗
提前谢谢
另外,服务具有自定义实现服务操作必须返回IQueryable才能使任何其他查询选项工作(这是必要的,因为WCF DS需要IQueryable为其他查询选项构造表达式)。 返回包含单个结果的IQueryable是完全正确的。在服务操作方法上添加[SingleResult]属性,让WCF DS知道IQueryable只返回一个值(以便查询选项相应地运行)
Query options $expand, $filter, $orderby, $inlinecount, $skip and $top cannot be applied to the requested resource