Created
March 4, 2014 19:49
-
-
Save khalidabuhakmeh/9354178 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public ActionResult Index() { | |
| return ProgressFlushResult(x => { | |
| x.PartialView("First"); | |
| x.PartialView("Second"); | |
| x.PartialView("Third"); | |
| }); | |
| } |
But for my money, yield return is still the most elegant way to do this.
Author
You essentially want to create a "Workflow", which at the end of each state/node you want to flush. The yield return might be confusing to devs who might be familiar with that construct as it pertains to an "enumerable" thing.
I personally would prefer a more explicit implementation to something like this so it sticks out.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You've already done all the "work" (DB queries or service calls) by the time you hit
return.I'm thinking of moving towards:
The
[FlushEarly("Head")]would run before the first line of code in the action result.Of course, the
Flush(ActionResult)method I proposed in my blog would still be required when you were using a dynamic head.