EntityDataSource where the number of associations> 0

I am trying to get items that have at least 1 chart, items and charts have 1 to many relationship.

I've tried this:

<asp:EntityDataSource ID="EntityDataSource1" ContextTypeName="Entities"
EntitySetName="Items" Where="Count(it.ItemCharts) > 0" runat="server" />

      

But I am getting the error:

No overloading of the canonical aggregate function "Edm.Count" is compatible with arg ...

How can I do this without using code?

Thanks for the help!

+3


source to share


1 answer


You have to use EXISTS to determine if the collection / association is empty:



<asp:EntityDataSource ID="EntityDataSource1" ContextTypeName="Entities"
EntitySetName="Items" Where="EXISTS(it.ItemCharts)" runat="server" />

      

+4


source







All Articles