こんにちは、EntityDataSource を使用してアイテムを取得しています。特定の地域のアイテムを取得したいと考えています。(項目と地域には多対多の関係があるため、項目には地域ナビゲーション プロパティがあります)。「IN」を使用してアイテムをフィルタリングしています。いくつかの組み合わせを試してみましたが、さまざまなエラーが発生し続けました。どうすればこれを整理できますか:
以下は私のデータソースです:
<asp:EntityDataSource ID="CataloguesDataSource" runat="server" ConnectionString="name=ModelContainer"
DefaultContainerName="ModelContainer" EnableInsert="false" EnableUpdate="false" OrderBy="it.EndDate desc,it.id desc" Include="it.Regions"
EntitySetName="Catalogues" Select="it.Id,it.Name,it.StartDate,it.EndDate,it.RetailerId"
Where="it.Retailer.Name=@RetailerName and @Region IN (select p.Id from it.Regions as p)" >
<WhereParameters>
<asp:ControlParameter Name="RetailerName" ControlID="hdnRetailer" DbType="String" PropertyName="Value" DefaultValue="abc" />
<asp:ControlParameter Name="Region" ControlID="hdnregion" DbType="Int32" PropertyName="Value" DefaultValue="" />
</WhereParameters>
</asp:EntityDataSource>