Asynchronous data loading


Author
Message
Chan
Chan
Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I created a BO which subclass BusinessLayer. I created FillAll() method which will load data from external source (not database). The data loading might take 30 seconds. The reason I put this code in BO is to ease data binding.



I would like to have async data loading for this. When form loaded, combobox should show "loading ..." as display value. Then program would call BO.FillAll() to query data from external source. Once complete, I want combobox to show "Please select a value" with a list of record.



How could I do this?



Thank you
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
We have already implemented this in the 1.6.2 update.  There is now the ability to asynchronously retrieve a BLOB (VarBinary) field which raises events notifying you of the progress of the retrieval.  This was added so that large fields (i.e. VarBinary fields storing serialized or image data) could be retrieved without a timeout on the connection while displaying a progress bar to the end-user.

This will probably not be released for 30+ days as it needs to be finalized in testing.  But this logic has already been added to the BO.

Chan
Chan
Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

What if my external data source is a very large XML, web service or large collection from other vendor class?



Does 1.6.2 allow me to do the same?
StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
What Trent was describing allows you to retrieve a single column from the database that is a VarBinary(MAX) (or IMAGE) field.  It doesn't do anything for what you are describing.

What you will need to do is create a method somewhere that will create a background thread to load the data.  Basically:

1) Create the method to load combo box.

2) This method starts a new thread and passes over the parameters to get to the data source and the combo box that is being populated.

3) Thread then retrieves the data and set the DataSource, DisplayMember, and ValueMember properties on the combo box (using Invoke() on the combobox to prevent CrossThreadViolationExceptions).

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search