Thanks for your post.
As I mentioned in the other thread, I got this working, but note it uses a collection.
Dim csub As New SubscriptionCollection()
Dim prefetchPath As IPrefetchPath = New PrefetchPath(CType(EntityType.SubscriptionEntity, Integer))
prefetchPath.Add(SubscriptionEntity.PrefetchPathOrgDeliverTo)
Dim filter As IPredicateExpression = New PredicateExpression()
filter.Add(PredicateFactory.CompareValue(smdbdata.SubscriptionFieldIndex.BillToOrgId, ComparisonOperator.Equal, 10400002))
csub.GetMulti(filter, prefetchPath)
Me.SubscriptionEntityBindingSource.DataSource = csub
When the subscription record is shown on the grid, I need to relate the related addressee information from the related organization. For testing purposes, I am choosing only address to make it simple. Using the above code, it prefetches properly, and I see only two queries, one for the initial subscription list, and the other for the address for each (it uses an in clause).
Ideally, I want to use the entity itself:
Organization -> Subscription -> BillToOrganization
| -> DeliverToOrganization
So, I start with an open on the organization entity. I would then try to bind the grid to the SubBillTo relation.
Can you post what you are trying to display with your grid. In your other post you mention that you have fields from related entities. So if you are displaying all of these values in a grid then each of those related entites need to have their prefetch path added. Post some more information and we'll get it working.
OK, so yes, one field from the organization for now - this is built in the designer as a field from related entity. As the collection code above works, can you help me adapt it to the entity itself? On the other post I have my attempt at doing it, it's not working
Lastly, I was concerned with the use of "in" for prefetch, as it supplied hard coded values (in params). Isn't there a limit to the length of the in clause or the overall size of the SQL batch? What would happen if I tried to prefetch city/state/zip for 3000 related rows (though I would not in all practicality)?
Thanks for working with me. My eval is going well, I will need to make my customers comfortable with this shift from a simple template built SP based template to your tool.