Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



12 ChAPTER 1 Design the application architecture LISTING 1-1 Calling an external data feed public async Task List() { ViewBag.SyncOrAsync = "Asynchronous"; string results = string.Empty; using (HttpClient httpClient = new HttpClient() { var response = await httpClient.GetAsync(new Uri("http://externalfeedsite")); Byte[] downloadedBytes = await response.Content.ReadAsByteArrayAsync(); Encoding encoding = new ASCIIEncoding(); results = encoding.GetString(downloadedBytes); } return PartialView("partialViewName", results); Asynchronous programming gives you different ways to solve performance issues where multithreading might help. You can create an action that returns synchronously but uses asynchronous work within the method to get work done faster. (The main thread has to wait only for the longest-running work unit to respond rather than waiting for all the work to occur, one after the other.) This kind of approach makes sense if you are merging the results from multiple service calls into a single model to be passed to the view. Another approach is to use an asynchronous partial view, such as in Listing 1-1. This helps the overall performance of your application by running the work in that partial view in a different thread, enabling the primary thread to continue to process other items. It also helps you avoid thread locking because your MVC4 application parses the action. A third approach is to break content out on the page and load it asynchronously from the client. A typical use case is to create your page normally, but rather than directly calling the action result @Html.Partial(“LeadArticleControl”, Model.LeadArticle) in your .cshtml file, you instead use JavaScript code that calls the server to ask for the partial view result after the page has been rendered on the client side, a traditional AJAX approach.
If you want to change selection, open document below and click on "Move attachment"

pdf

owner: ChrisMoses - (no access) - Exam Ref 70-486- Developing ASP.NET MVC 4 Web Applications.pdf, p30


Summary

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Details



Discussion

Do you want to join discussion? Click here to log in or create user.