New Posts New Posts RSS Feed: binding an entitylist that contains ~5000 records
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

binding an entitylist that contains ~5000 records

 Post Reply Post Reply
Author
yongbum75 View Drop Down
Newbie
Newbie


Joined: 21-Jul-2008
Posts: 17
Post Options Post Options   Quote yongbum75 Quote  Post ReplyReply Direct Link To This Post Topic: binding an entitylist that contains ~5000 records
    Posted: 11-Aug-2008 at 5:33pm
Hi, I am trying to bind an entitylist of 5000 records to a BindingSource object and it takes a good 2 seconds to do that.  The problem is that I have to bind to 5 different BindingSources and it is therefore taking a total of 10 seconds. 

      mCustomers = mPersMgr.GetEntities(Of Customer)()  --> this returns about 5000 records
      mCustomer1BS.DataSource = mCustomers --> takes 2 seconds
      mCustomer2BS.DataSource = mCustomers --> takes 2 seconds
      mCustomer3BS.DataSource = mCustomers --> takes 2 seconds
      mCustomer4BS.DataSource = mCustomers --> takes 2 seconds
      mCustomer5BS.DataSource = mCustomers --> takes 2 seconds

The reason I have to bind to 5 different BindingSources is because I have 5 different Customer dropdown controls on my form (think of my app as a shipment tracking system where any given shipment can stop at multiple customer sites upto 5 different sites).

Is there anything I can do here to reduce the total time it takes to perform databinding?  Since the 5 dropdown controls could potentially have 5 different values, I think I need 5 instances of BindingSource, am I correct?

Thanks for your help in advance!

Back to Top
jeffdoolittle View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Jun-2007
Location: United States
Posts: 146
Post Options Post Options   Quote jeffdoolittle Quote  Post ReplyReply Direct Link To This Post Posted: 11-Aug-2008 at 8:30pm
Perhaps you can take more of a "type-ahead" approach?  For example, if the user begins typing in a customer name, while they are typing, you could populate TextBox auto-complete values while they are typing (using the AutoComplete functionality of the TextBox class).

public static EntityList<Customer> GetCustomers(PersistenceManager pm, string partialName) {
    EntityQuery query = new EntityQuery(typeof(Customer));
    query.AddClause(Customer.CustomerNameEntityColumn, EntityQueryOp.StartsWith, partialName);
    query.Top = 10;
    return pm.GetEntities<Customer>(query);
}

You could keep calling this method as the user types and continually refresh the auto-complete list from the return value of this method.  Then you can avoid passing so many customers across the wire, and you won't have performance issues with data binding.

What do you think?

--Jeff
Back to Top
yongbum75 View Drop Down
Newbie
Newbie


Joined: 21-Jul-2008
Posts: 17
Post Options Post Options   Quote yongbum75 Quote  Post ReplyReply Direct Link To This Post Posted: 12-Aug-2008 at 6:06am
Why didn't I think of that!! :)

Thanks!  Great product, great support, what more can I possibly ask?  You guys are simply amazing! 
Back to Top
jeffdoolittle View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Jun-2007
Location: United States
Posts: 146
Post Options Post Options   Quote jeffdoolittle Quote  Post ReplyReply Direct Link To This Post Posted: 12-Aug-2008 at 8:36am
and I don't even work for IdeaBlade!  :)
Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post Posted: 12-Aug-2008 at 10:09am
Yongbum:
 
Assigning the EntityList to the BindingSources shouldn't be taking any significant amount of time, unless you've got some kind of eventing going on (e.g., something in BindingSource.CurrentChanged or whatever).
 
I usually assign my EntityLists to the BindingSources *before* loading data into the lists:
 
      Dim mCustomers As New EntityList<Customer>()
...
      mCustomer1BS.DataSource = mCustomers
      mCustomer2BS.DataSource = mCustomers
      mCustomer3BS.DataSource = mCustomers
      mCustomer4BS.DataSource = mCustomers
      mCustomer5BS.DataSource = mCustomers
 
then load the data
 
      mCustomers.ReplaceRange(mPersMgr.GetEntities(Of Customer)())
 
Using ReplaceRange() allows you to load and reload data as needed witout having to reconfigure the link between the EntityList and its BindingSources.
 
Nevertheless, I tried it the way you did it against 121,000 SalesOrderDetail records from Adventureworks 2000, and the time to assign the EntityLists to the BindingSources was about .0015 seconds compared to 11.5 seconds to load the data (local database, of course).  Must be something else going on.
 
 
Back to Top
yongbum75 View Drop Down
Newbie
Newbie


Joined: 21-Jul-2008
Posts: 17
Post Options Post Options   Quote yongbum75 Quote  Post ReplyReply Direct Link To This Post Posted: 12-Aug-2008 at 10:31am
I'm using a Custom ComboBox (http://www.ideablade.com/forum/forum_posts.asp?TID=271) with AutoCompleteMode option turned on in order to be able to utilize the DropDown mode (as opposed to the default DropDownList mode).  Perhaps that is causing the slowdown?  I'll check it out.

Back to Top
yongbum75 View Drop Down
Newbie
Newbie


Joined: 21-Jul-2008
Posts: 17
Post Options Post Options   Quote yongbum75 Quote  Post ReplyReply Direct Link To This Post Posted: 14-Aug-2008 at 10:02pm
It was definitely Custom ComboBox.  Well, to be more precise, it was the AutoCompleteMode that somehow slowed it down.  As soon as I disabled AutoCompleteMode, it became very fast.  Thanks JeffDoLittle and Greg for your help!
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down