News

Steve Sanderson Wows Web-Devs with Peek at 'Blazor United' for .NET 8

"We've started some experiments to combine the advantages of Razor Pages, Blazor Server and Blazor WebAssembly all into one thing."

Steve Sanderson has done it again, adding yet more functionality to the groundbreaking Blazor project, which he created.

This time it's combining the Single Page Applications (SPA) tech of Blazor with plain HTML, which in the ASP.NET Core camp comes from Razor Pages, MVC and CSHTML files.

Or, in Sanderson's own words: "We've started some experiments to combine the advantages of Razor Pages, Blazor Server and Blazor WebAssembly all into one thing, so this would be a way for Blazor components to be a single architecture for all your web UI scenarios -- that's for plain HTML rendering and for full interactivity either server-side or on WebAssembly -- and that's all in one project with the ability to easily switch between different rendering modes and even mix them in the same page."

Those words came in a 13-minute YouTube video titled "Blazor United prototype," described as "A quick peek at some of the cool Blazor prototypes we're experimenting with for .NET 8."

Steve Sanderson
[Click on image for larger view.] Steve Sanderson (source: YouTube).

Here's how he set up his demo:

So consider this. Some web apps need rich interactive UIs. These are often called Single Page Applications or SPAs, but many web apps just need to generate plain HTML to handle requests as quickly as possible. Now many web apps use both of these techniques in different places. Maybe the public pages are displaying HTML and the logged-in area is a SPA.

Now in the past, this would have required two different technologies. For example in .NET to generate HTML we've got MVC and Razor pages with CSHTML files, whereas for interactive SPAs we've got Blazor WebAssembly or Blazor Server, so that's two different architectures.

But there's a growing trend within the industry to try and unify these into a single technology that can do both plain HTML and rich SPAs from one architecture. Now the point of this is you don't have to limit yourself to just one approach up front -- use whatever approach is relevant for each part of your app. You can mix and match even within a single page and easily switch if your requirements change.

While the project is destined for .NET 8, so far is just a prototype, though adventurous web developers could attempt to build it from the raw source code in the Blazor United branch in the ASP.NET Core GitHub repo.

It's the latest milestone initiative from Sanderson, who has helped point the Microsoft manifestation of his pet project at everything from mobile to desktop. For the uninitiated, Blazor allows for C#-based (no JavaScript required) SPA web development with a Blazor Server component and a Blazor WebAssembly component for client-side development.

Sanderson's video has sparked much discussion on the social coding scene, drawing oohs and aahs from developers on YouTube (101 comments, nearly 9,000 views), Reddit (90 comments) and Twitter (58 comments, 491 likes and some 96,000 impressions at the time of this writing) along with a wee bit of snarkiness on Hacker News.

"Oh my god. This is glorious! I hope they can make it to .NET 8," read the first comment on the Reddit thread.

"You guys took it one step ahead, it's incredible! People were asking if it was possible to support Blazor Server and WebAssembly side-by-side in the same app. Now you made their choice for them!" read a comment on YouTube.

"This is glorious!!! Blazor Server is fantastic but there are use cases (like offline pages) where diving back to Angular or React for parts of the app was the only option. A unified Razor/TS experience with both client and server step-debugging would be a game changer," said a tweet reply.

Yes, there were questions, concerns and snarky negativity as always (some likened it to ColdFusion and jQuery), but overall the social response has been enthusiastic.

Sanderson used code examples to explain the new functionality, demonstrating "streaming rendering" and piecemeal "progressive enhancement" that added interactive functionality like drag-and-drop. He showed how the approach can be applied to individual components or an entire page. He said an "auto render" mode, for example, lets developers "dynamically choose on a per-page or per-component basis between server and WebAssembly based on whether the user has already got the files cached, and you can use whichever combination of rendering modes makes sense for each different part of your web site without having to change your architecture."

The Blazor guru posted the video to solicit such developer feedback as mentioned above.

"Now that is just a prototype and a lot of it will probably change, but we are serious about doing something like this in .NET 8," Sanderson said in closing. "And since it's just a prototype, we don't even have any packages yet that you can actually download and try it. So if you are really keen you can go to our GitHub repo and into the Blazor United branch and actually build the whole framework yourself to try it, or you could just wait until we start releasing actual real preview releases. Now we would love to know whether this seems relevant to you and what your scenarios and priorities would be so let us know on GitHub."

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube