Mathieu wrote:
Hi all,
the thread about binding a entity collection to a grid in winforms coding is set to not active / completed, although my question hasn't been answered.
Could someone please advise me concerning the use of grids and binding entity collections to it in winforms programming? I'm still having the problem that when i'm using an entity collection which contains fields on related fields to bind to a grid, it takes very loooong time to show the grid.
Thanks in advance!
The problem with the fact that it takes a LOOOOOOOONG period of time, is because the grid triggers lazy loading (I pressume you're using selfservicing). Say you have 100 order objects and in the order a field called CompanyName and that's mapped on Order.Customer.Companyname. For each row, the grid will read that field, which triggers the lazy load routine to load just that entity, so for each of the 100 order objects, a query is used.
Instead, prefetch the related entities using a prefetch path. This is much more efficient.