I've read a lot about prefetch and now I'm facing a problem. I've got calculated properties in my object that ABSOLUTELY need to be used in a ASPxGridView bound to a XpoDataSource. I can't make it a persistent calculated property because it would require me to recalculate it for a a 2.000.000 records database. I didn't have performance problems when the database was small, but now that the database is growing and growing, the exatraneous, SELECT N+1 queries that XPO make to the database for each row just to read the calculated properties (which reference a details collection) is just adding up and making the page unresponsive in first load and each grid pagination.
The calculated property issues a COUNT against a detail colllection, so, for each row displayed on the page, it makes an extra call to the database to count how many detail records there are for that specific row so that the column can be shown.
I was trying to call PreFecth as we do with XPCollection, but there I've found nothing of the sort to "tell" the Session/Xpo that it needs to prefetch that specific collection, so that the calculated property won't require an extra hit to the database…
How can I achieve that?