Walaa.
I ended up doing the following, which worked quite nicely.
I modified the entityInclude.template so the "GetMulti<MappedFieldNameRelation>" had an "intermediateFilter" as an optional paramter as follows:
Public Overridable Function GetMulti<[MappedFieldNameRelation]>(forceFetch As Boolean,
entityFactoryToUse As IEntityFactory,
Optional ByVal intermediateFilter As IPredicateExpression = Nothing) As <[RootNamespace]>.CollectionClasses.<[RelatedEntityName]>Collection
Then in the code I added the following:
' existing code:
Filter.Add(New FieldCompareValuePredicate(EntityFieldFactory.Create(<[CurrentEntityName]>FieldIndex.<[EntityFieldName]>), ComparisonOperator.Equal, Me.<[EntityFieldName]>))<[NextForeach]>
' added code:
' Add Intermediate Filter, if it exists
If (intermediateFilter IsNot Nothing) Then
Filter.AddWithAnd(intermediateFilter)
End If
This allows me to call GetMultiChildList(False, Filter) and filter on the "intermediate" table.
One thing to note:
Since the "intermediate table" gets an alias of: "<IntermediateEntityName>_"
You have to specify an "object alias" for any filter Predicate's that are added to the Predicate Expression that is passed to the "filter". I'm not aware that you can specify "object aliases" for overloaded Predicate creation (possible in VB2005 and C#) so I'm not able to use that, but I can handle using the PredicateFactory to create my prediates
In a later version, I'll may remove this requirement by "walking" the "intermediateFilter" and setting all the aliases of the "predicates" to the <IntermediateEntityName> in the GetMulti<> routine.
Personally, I would like to see this "intermediateFilter" capability added to the shipping product. I find myself many times needing to "filter" on that intermediate table (especially if it is a "link" or "junction" table) and whereas I can filter on 1:m relationships, I cannot filter on any m:n relationships.
Just my thoughts.
Andrew.