arschr wrote:
I'll raise a support issue with developer's express to see what they have to say, since the DataGridView is fast with both collections.
In the mean time how can I trace or log what the grid is asking the EntityCollection<T> to do that takes it so long?
Binding is done through the EntityView2, so a collection returns its DefaultView instance as it implements IListSource. EntityView2 implements ITypedList, which should be consulted once by the bound control. ITypedList builds the list of property descriptors to use for the columns in the grid.
As you said the normal .net gridview binds very fast to the entity collection (as in, close to the dto stuff), it's not likely it's the code in the entityview2 as the datagridview calls the same code: IListSource.GetList(), which returns the DefaultView instance (which is an EntityView2 instance with the collection GetList is called on), that instance's ITypedList.GetItemProperties() is called, which produces the property descriptors and returns them to the caller. Then the grid builds the column with these descriptors. It will then fetch the data through the view by iterating over it.
If devexpess needs info from us regarding internals, just post in this thread and we'll let them/you know.
In the meantime, you could try profiling the application you wrote, and especially this form, it would give great insights in what it might be.
- change your code a bit so that it won't fetch 12000 rows but say 500. Profiling is slow, so 12000 rows will likely take ages and it's not really necessary to fetch all of them to spot a hotspot.
- If you don't have a .net profiler installed, please go to www.jetbrains.com and download the dottrace trial and install it.
- Run the profiler (dottrace or e.g. ants.net) and order it to start your application but NOT to start profiling (so you can switch on profiling right before when you fetch the rows). Also make sure you don't filter out calls to the ORMSupportClasses dll. Eventually, use the debug build ormsupportclasses dll in the runtime lib folder.
- your application is now running and the profiler is too, but profiling hasn't started yet. You go in your application to the form which fetches the rows and which is very slow. Right before opening it (or clicking the button which triggers the fetch + binding, i.e. which is slow), on the profiler switch ON profiling. This makes the profiler record what's going on. Open the form and bind the data. This will take some time.
- after the data is bound, order the profiler to get a snapshot. Don't close the profiler yet, get a snapshot first.
- order the profiler to quit the application.
- the profiler now has a snapshot loaded which contains all activity between when you started profiling and when you stopped. You can now browse the tree of calls to see where most of the time was spent. This is valuable information for both devexpress (if it's in their code for example) or us (if it's in our code).
Good luck. If you need info about profiling etc. let me know as well