This is a migrated thread and some comments may be shown as answers.

SearchProvider / Custom SearchRequest / Async Search

2 Answers 48 Views
Map
This is a migrated thread and some comments may be shown as answers.
Jonas Hero
Top achievements
Rank 1
Jonas Hero asked on 29 Jul 2010, 02:16 PM
Hello!

I am using the BingSearchProvider to get geodata for addresses. Simply by creating a SearchRequest an calling the SearchAsync method. What I need is some data of the request in the method linked to the SearchCompleted event.

My first attempt was writing a custom SearchRequest class with the needed data fields, inherited from the SearchRequest class. The request works fine but i didn't find any data of the request object when code runs into the attached method.

The second attempt was creating a new SearchProvider instance for every request and passing the needed parameters to the SearchCompleted method by binding the handler with an delegate, which lead to massive performance problems (as I thought).

Is there any possibilty to get the SearchRequest in SearchCompletedEventArgs in the event handler method? Or perhaps, someone of you could figure out a clean pattern for such a scenario.

I will greatly appreciate any bit of information about this topic. Thank you!

Jonas

2 Answers, 1 is accepted

Sort by
0
Accepted
Andrey
Telerik team
answered on 30 Jul 2010, 11:51 AM
Hi Jonas Hero,

You can use UserData property of the request for these purposes (it will be passed to the response associated with this request).  It can be used to identify request-response pair and is retrieved through the RequestUserData property of the response object.

Greetings,
Andrey Murzov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jonas Hero
Top achievements
Rank 1
answered on 30 Jul 2010, 02:36 PM
Thank you! I was using the Q1 2010 release which doesn't have this feature.
Tags
Map
Asked by
Jonas Hero
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Jonas Hero
Top achievements
Rank 1
Share this question
or