I have the following code which prefecthes a couple of tables with no problems:
Public Shared Function GetAssignmentByTeacherIdent(ByVal teacherIdent As Integer) As MedfordSchoolDistrict.Elementary.GradeBook.LLBL.HelperClasses.EntityCollection
Dim Sorter As ISortExpression = New SortExpression
Sorter.Add(SortClauseFactory.Create(Elementary.GradeBook.LLBL.AssignmentFieldIndex.DueDate, SortOperator.Ascending))
Sorter.Add(SortClauseFactory.Create(Elementary.GradeBook.LLBL.AssignmentFieldIndex.Name, SortOperator.Ascending))
Dim Filter As IRelationPredicateBucket = New RelationPredicateBucket
Filter.PredicateExpression.Add(PredicateFactory.CompareValue( MedfordSchoolDistrict.Elementary.GradeBook.LLBL.AssignmentFieldIndex.TeacherIdent, ComparisonOperator.Equal, teacherIdent))
Dim PrefetchPath As IPrefetchPath2 = New PrefetchPath2(CType(EntityType.AssignmentEntity, Integer))
PrefetchPath.Add(AssignmentEntity.PrefetchPathGroupAssignment)
PrefetchPath.Add(AssignmentEntity.PrefetchPathAssignmentSubSkill)
GetAssignmentByTeacherIdent = New EntityCollection(New AssignmentEntityFactory)
_Adapter.FetchEntityCollection(GetAssignmentByTeacherIdent, Filter, Nothing, Sorter, PrefetchPath)
Return GetAssignmentByTeacherIdent
End Function
I have another table called Score which has a FK from table AssignmentSubSkill. What I want is to add a prefetch that would also return the Count of Score for AssignmentSubSkill.
Is that possible to do with a prefetch and where would it store this Count value?
Thanks,
Fishy