Click here to Skip to main content
14,878,631 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there,

We are having some performnace issues with our WPF application. We are using WPF with PRISM and for data layer we are using Enterprise Library. We have search screen where in we will provide 10 search criteria's , When we search for one value, SP is returning the values quickly but in Enterprise Library we use executereader some thing like this

C#
  int changeUserIDOrdinal = reader.GetOrdinal("ChangeUserID");
                        int changeDateOrdinal = reader.GetOrdinal("ChangeDate");

                        while ((reader.Read()))
{
var screenField = new VisitField();
if (!reader.IsDBNull(changeUserIDOrdinal))
                            {
                                screenField.ChangeUserID = reader.GetInt32(changeUserIDOrdinal);
                            }
                            if (!reader.IsDBNull(changeDateOrdinal))
                            {
                                screenField.ChangeDate = reader.GetDateTime(changeDateOrdinal);
                            }
                            screenFields.Add(screenField);
}


So it will iterate the data and fill the collection and bind the collection to Property in the ViewModel. But we are getting 40K records some times and we are getting connection time out all these things.


For the UI, I am having following properties for my Data Grid,

XML
VirtualizingStackPanel.IsVirtualizing="True"
                         VirtualizingStackPanel.VirtualizationMode="Recycling


Is there any better way to improve the performance on DB side and WPF side ?


Thanks,
Kiran
Posted
Comments
[no name] 22-Jun-14 9:07am
   
"40K records", try querying a reasonable amount of data. No one is going to read through 40K records.
Sergey Alexandrovich Kryukov 22-Jun-14 13:54pm
   
Exactly. It all sounds like a general design issue not related to WPF pe se.
—SA
Sergey Alexandrovich Kryukov 22-Jun-14 13:52pm
   
So far, it does not sound like you have a bottleneck in WPF... Could you profile everything, using some profiler?
—SA
_Maxxx_ 23-Jun-14 3:01am
   
How does the SP perform when 40K records meet the criteria? If this is acceptable, then you could just present the first couple of hundred or so - if not, then you need to limit the Sp to returning the Top n records rather than all of them
earloc 24-Jun-14 4:29am
   
what type is "screenFields"? Is is some sort of ObservalbeCollection<t> / INotifyCollectionChanged? If so, every single record would result in a change to the UI. Consider loading all records "off screen" and set the collection once it finished loading. Or use some sortof "DataVirtualization"-approach. just feed your favorite search-engine (e.G. https://datavirtualization.codeplex.com/ or http://msdn.microsoft.com/en-us/library/cc716879(v=vs.110).aspx)

nevertheless, i agree with the other folks that it sounds like a general design-issue rather than a "real" performance bottleneck.
itsgkiran 24-Jun-14 10:28am
   
Thanks for the reply, Yes, It is Observable Collection with NotifyPropertyChanged. I am getting main problem with Enterprise library, it is taking too much time to read the elements from reader and add it to list.

Kiran
itsgkiran 24-Jun-14 10:23am
   
Thank you all for your suggestions. As Wes Aday said it is pretty much high but that's the requirement i got, I suggested Paging also they don't want that. So, I will try with Data Visualization if not will go for Paging only. I have two doubts,

1. If i want to add records to DataGrid after scroll reaches to end, How Can i do that ?
2. I am using Enterprise Library for Data access layer is there any best alternative for this in terms of performance.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900