I am probably missing some very basic syntax gotcha in here. Yet it might that the Razor not smart enough yet to 'understand' html output done inside a delegate like this (for the lack of official documentation from anybody related to the makings of the latter, I have to post this here):
@{
ParallelQuery pQuery = rootData.ChildNodes.AsParallel();
Func<ParallelQuery, string> builderAction = delegate
{
while (rootData.HasChildNodes)
{
foreach (SiteMapNode node in pQuery)
{
<li><a href="@node.Url">@node.Title</a></li> //CANT SEE ANY HTML TAGS AVAIL TO SPEW
}
}
return string.Empty;
};
};
YET JUST OUTSIDE OF THE DELEGATE BODY:
//CHARM - BUT I WANT TO USE DELEGATES, WHY NOT??
@{
foreach(var x in new string[100]) {
<li>
<a href="@x">@x</a>
</li>
};
What’s wrong with this picture??
Edit 1:
Am I doing something weird here, just to build a tree list with links? It seems a bit more complicated than what the Razor’s supposed to be all about in tearms of ease.
Execution of the page continues to run as you’re running any parallel queries.
By the time your parallel query finished running .net already sent your page to the client.
If you run a parallel query inside the function Ajax is calling it wouldn’t work either.
Somehow you’ll need to wait until a parallel query has finished because it’s non-blocking. So at the end of your code running the parallel query you’ll need to wait somehow until its finished.