From Rockford Lhotka's Expert C# 2008 and VB 2008 Business Objects books
I am using CSLA 2.0 with .NET 2.0.
On my win forms based application, I have a custom datagrid (designed by our team), which saves user preferences (sorting, filtering, columns width, hiding columns etc.,). To have sorting and filtering on the datagrid on multiple columns, team decided to use ObjectListView by converting the datasource to a objectListView (as per my understanding this was found online via some forum on CSLA( may be this one..i dont know).
datagrid.datasource = New CSLA.ObjectListView(myListObject)
This datagrid loads around 15,000 - 20,000 rows at one time.
This has a huge performance hit. My Win form takes nearly 2-3 minutes to load.
When i debug i see that, though the CSLA objects takes about 30-40 seconds to fetch the data from the DB and assign to the datagrid, it then loops on public properties like for ever...I am unable to get past debugging this...
As you can see there are many variables to my problem. I am just wondering if the answer to this will be an upgrade to CSLA 3.0 as it promises performance increase, atleast to a certain extent.
I am also thinking about a third party datagrid control to further improve the performance.
It will be of help if some one can shed light on the performance improvement part of CSLA 3.0.
Will an upgrade to CSLA 3.0 improve performance signifiacntly?
Does anyone have the same issues?
I'm not sure this is a CSLA problem. I certainly agree that showing the user tens of thousands of rows is not a good way to do things, but we can easily fetch upwards of 10-20,000 rows/second from a SQL database into a grid, even faster with a narrow table, and I'm not even using a native DAL but instead letting an ORM generate my SQL and fetch objects for me.
You mentioned looping on public properties, which I could see being normal if this is just your grid trying to paint itself and fetching the values from your objects.
I'd consider trying a profiler to see where your code is spending it's time. (I test drove the ANTS profiler last year and liked it, but I'm sure there are other good ones).
In the case of csla 2.0, ensure that you are not loading your object values through your properties. This will slow things down since the property setters usually check for authorizations and may fire change events if you haven't paused the firing of events. You should aim for loading the values directly into the fields. If you are doing this 20,000 times, you will experience significant slow down.
I have also experienced slow-loading data grids in the past ... if I can remember correctly, debugging pointed me to an ErrorProvider that was bound to the same bindingsource as my grid. I'd have to look at some old code to remember exactly what I did ... if you temporarily remove any errorproviders from your form and it then loads a lot faster, then that may point to your problem. Otherwise, I am totally wrong!
Also, how does the "ObjectListView" work. If it scans through and reads all properties of all records, then I assume the authorization checks are being called at least num_of_properties_per_record * number_of_record times.
Good luck.
Leigh
Thank you all for your comments.
I am also investigating how to acheive paging on my Win data grid.
Paging is easy to do with a .NET object - Data Adapter has one implementation that lets you take the start records and max records. This implementation is not available on a CSLA.data.Objectadapter.
da.Fill(ds,startrecord,maxrecords,srctable)
maxal,
Can you please give me some sample code or example of how you did the lazy loading with Dev express grid ?
I used the ObjectListView in 2.0.
In my view it is obsolete in 3.6. Because now we have LINQ to CSLA with indexing. I plan to fully remove it from my project next week and learn the new technology at the same time.
If I recall correctly the ObjectListView does have a performance hit for a large number of items. I think I saw it for 1,000 items. I am pretty sure it is a big part of the hit you are seeing with 15,000 items.
Joe
Maxal,
Thank you. please do let me know how to get to that post when you do so.
Jonny,
Thank you for your reply. I searched my APP and found that CanReadPropert(True) is in every id property that uniquely identifies a record/object.
See below for property code.My APp does not implement any authorization for now. But i strongly beleive that who ever put it in there did so for a reason. Why do you think this line of code is in there?
<System.ComponentModel.Browsable(False)> _
Public ReadOnly Property Id() As Integer
<System.Runtime.CompilerServices.MethodImpl(Runtime.CompilerServices.MethodImplOptions.NoInlining)> _
CanReadProperty(
Curelom,
I appreciate your technical advice and not the rest.
dlambert,
Thank you. I am going to try by commenting this line of code and will let you all know. Unfortunately this has to wait till Monday, as i am not in office today.