Walaa wrote:
So is there something more I should have done? You cannot apply a sort when building a typed list... so not sure how to do that in the designer...?
Just try to run the code and fetch the TypedList as you would normally do, pass in a GroupByCollection, and check the returned resultset and the generated query.
I already changed the TypedList to Count on the ID, which is an int... so yes, the code does work fine...
What I was really talking about is that the generated code creates a few items such as:
GetGiveAwayCountTypedList
GetGiveAwayCountTypedListFieldIndex
GetGiveAwayCountRow
The GetGiveAwayCountTypedList is a collection of GetGiveAwayCountRow objects... and if I cast the item to that specific object, GetGiveAwayCountRow ... that is the object that has the incorrect boolean... It is based off the actual type of the column in the database and does not take into account that the Aggregate of Count should return an int or something more than a boolean...
For example if you counted on a varchar, then it would be based on a string... It really does not matter what field you count on, the predicate to get the result if the real counter...
What I don't understand is if LLBLGen generates the three types above (the TypedList, ListFieldIndex and Row) ... it seems the Row version should return the correct properties on the defined typed.
If this does not make sense, I will let this go and just consider this something of me using LLBLGen wrong... not trying to say it does not generate the right result, just the generate Row type has the mapped column as a count as an incorrect type ... Not sure how to better explain it. Sorry if this has been too confusing.
Edit: Here is some code:
GetGiveAwayCountTypedList list = new GetGiveAwayCountTypedList();
IPredicateExpression filter = new PredicateExpression( MemberProgramsFields.MemberId == memberId );
filter.Add( MemberProgramsFields.ProgramId == programId );
adapter.FetchTypedList( list, filter );
foreach( GetGiveAwayCountRow row in list.Rows )
{
... do some work...
int count = row.GiveAwayCount; <--- the GiveAwayCount was a boolean
... do some more work...
}
This code is not all inclusive in the example, what I really wanted to show is the foreach cast the rows to the GetGiveAwayCountRow that LLBLGen generated... and the only mapped column is the GiveAwayCount (that is an alias) the was counted on a boolean column...