How to add a child table graph to EntityDataSource
I have an EntityDataSource working to get the row data from tblOrderFile like this:
<asp:EntityDataSource ID="entityDataSourcePreorder" runat="server"
ConnectionString="name=iDBEntities"
DefaultContainerName="iDBEntities" EnableFlattening="False"
EntitySetName="tblOrderFiles"
Select="it.[pkOrderFileID], it.[fkOrderFileStatusID], it.[Filename], it.[CreateDate], it.[UserId]"
AutoGenerateWhereClause="True" EntityTypeFilter="" Where="">
Now I would like to change it to return the number of rows in the tblOrderFileItem child table (named tblOrderFileItems).
I found a way to make Count work by adding an Include directive like this:
<asp:EntityDataSource ID="entityDataSourcePreorder" runat="server"
ConnectionString="name=iDBEntities"
DefaultContainerName="iDBEntities" EnableFlattening="False"
EntitySetName="tblOrderFiles" Include="tblOrderFileItems"
AutoGenerateWhereClause="True" EntityTypeFilter="" Where="" >
</asp:EntityDataSource>
but I believe this returns all columns of all rows for each order item. I just want to graph and don't want to deliver the rest of the data to the webpage.
I also tried just adding it.tblOrderFileItems.Count to the Select statement, but get the error
'Count' is not a member of 'Transient.collection [MyDBModel.tblOrderFileItem (Nullable = True, DefaultValue =)]'. To retrieve a property of a collection item, use a subquery to iterate over the collection.
+1
source to share