title: WPF, MVVM, and Asynchronous work
body: <p>I know this question has been asked here before, but I've read through several answers that haven't helped me.</p>
  
  <p>I have a ComboBox that needs to  get some information related to a selection from a database (probably on lost focus, to stop a thousand calls during scrolling). This information is for display only, and not critical, so getting on a background thread/task sounds like the perfect solution. It does take several seconds though, as it is getting counts from some very large tables. The user should be free to move on to other tasks, as this information really is just for display/reference only.</p>
  
  <p><a href="https://stackoverflow.com/questions/5483565/how-to-use-wpf-background-worker">This question</a> advocates using a Background worker, but this solution has two issues. 1) Changing the selection while the worker is already running introduces problems. You can either not start it the second time, meaning when it returns it is no longer showing valid info for the new selection, or try to cancel it (which doesn't always work). 2) For some reason I cannot explain, the method that actually accesses the database for the background worker returns slower if the method is in Model than if in the ViewModel, where I do not think it belongs. I really don't know why.</p>
  
  <p><a href="https://stackoverflow.com/questions/5196257/wpf-mvvm-updating-the-view-model-on-a-background-worker">This question</a> has several votes, but the OP's question is worded very poorly, and the selected answer just says "yeah that should work."</p>
  
  <p><a href="https://stackoverflow.com/questions/2531830/how-do-you-implement-async-operations-in-c-and-mvvm">This question's method</a> looks promising, but the linked video is an hour long (I watched the whole thing), and touches on the dispatcher only for 10-15 seconds without explaining it. If someone has a link to an article that covers this method more in-depth, that would be good.</p>
  
  <p>Thread pooling, as <a href="https://stackoverflow.com/questions/5038590/what-is-recommended-way-to-perform-async-tasks-in-wpf">suggested here</a> looks like it is probably the best way to go, as multiple requests for lookup just get queued, instead of causing already-running errors. However, it has no explanation of how to use a thread pool, instead linking to the MSDN article. If someone has a link to an article that covers this method more in-depth, that would be ideal, as it seems like the better solution (of course, I could be wrong).</p>
  
  <p>I really tried to do my research on this one, but most of these answers just tell you what method to use, not how to use it. I am really looking for a "how-to."</p>