Wednesday, 25 April 2012 4:19 PM
I have a web page which has a form. The user fills in the form and this is posted to CRM.
As you know, it takes about 10 seconds for the post to happen.
I would like to do this asyncronously so I had two ideas:
1. Somehow open the web service on page load so that the "Create" method fires straight away. The form fill will take longet than 10 seconds and i though I might be able to use Endinvoke as a safety net.
2. Wrap my method which calls the Service.Create in .NET async delegate
Is 1 even possible. It seems that it is the "Create" method which actually opens the connection so I can't seem to split that?
For 2, will my async method still work if the user navigates to another page before it completes or possible leaves the site/closes the browser?
Friday, 27 April 2012 12:48 PM
I guess there can be different answers.. If you don't need the results from CRM (new record id, for instance), then you might create a separate thread and use ConcurrentQueue to pass form input to that thread. The disadvantage is that you've taken the thread..
If you use delegates, though, you will also take the thread (it will happen "on demand", but you may end up with more than one thread being consumed if two or more different users can submit data at the same time)
To answer your specific questions: Create will open a connection(it will create a record in CRM). Async method should still work(though you may not be able to send async execution results back to the page)
Alex Shlega, GotchaHunter.Net