Q&A

Building Blazor Applications

Blazor is a modern .NET application framework, primarily used to build web applications. Since its release in 2020, it has evolved with new features and capabilities, enabling developers with the ability to produce high-quality applications for their uses.

It can be hard to keep abreast of all the new features and innovations in Blazor as it spreads out from its web roots, but some experts are going to explain everything devs need to know about modern Blazor in an upcoming, full-day workshop during the Visual Studio Live! developer conference in Las Vegas March 10-14.

It will be presented by a trio of well-known dignitaries in the dev space: Jason Bock, MVP (C#), Staff Software Engineer, Rocket Mortgage; Allen Conway, Microsoft MVP, Azure App Modernization Consultant, Xebia; and Rockford Lhotka, VP of Strategy, Xebia.

In the Building Blazor Applications workshop, they'll cover numerous features that Blazor brings to the table. They will also discuss different hosting models and how you can use them to your advantage. At the end of the workshop, attendees will leave with a comprehensive understanding of the Blazor landscape, promised to specifically learn:

  • How to build web, desktop, and mobile apps with Blazor
  • About authentication and authorization with Blazor
  • How to build apps top to bottom, from the UI to data access, with Blazor and .NET

We caught up with the team to learn more Blazor, their presentation specifically and how attendees can prepare for it.

Visual Studio Magazine: What inspired you to present a session on this topic?
Team: It all started when WebAssembly was announced in 2015. That format effectively allowed any programming language to run natively in the browser. It our minds, it was an inevitability that C# would provide that capability, which is exactly what Blazor does. Since Blazor's release in 2020, it has become far more than just “running C# in a browser”. It's a full-fledged, modern web application framework, providing advanced rendering capabilities and a rich component model.

"With Blazor, you can write your web applications using C# and .NET and run that code wherever you want. That's exciting for us, and we want others to learn how to use Blazor as well."

Rockford Lhotka, VP of Strategy, Xebia

With Blazor, you can write your web applications using C# and .NET and run that code wherever you want. That's exciting for us, and we want others to learn how to use Blazor as well.

While its initial claim to fame was primarily using C# instead of JavaScript, Microsoft documentation now focuses on three hosting models, so what are the key differences between Blazor Server, Blazor WebAssembly, and Blazor Hybrid?
Your Blazor app code can execute in different physical locations.

In a pure Blazor Server app, your code runs on the web server, communicating with the browser over a bi-directional channel based on the SignalR technology. In a pure Blazor WebAssembly app, your code runs in the browser using the web standard WebAssembly technology. In a Blazor Hybrid app, your code runs on the client device as a native app; whether that be in iOS, Android, Windows, or macOS.

Each of these hosting models has pros and cons that must be understood and evaluated based on your business requirements.

Beginning with Blazor 8, the Blazor server and Blazor WebAssembly hosting models became mixed with the concept of render modes for web scenarios (Blazor Hybrid is unaffected). This is because in Blazor 8 the default project template for Blazor uses Blazor Server, Blazor WebAssembly, and a new render mode called Blazor Server-Static.

The new render mode model attempts to provide the user with content in the browser as fast as possible, often using server-static rendering. It then switches to one of the interactive modes: interactive server or interactive WebAssembly. Which one depends again on what will get the user an interactive experience faster. Over time, most interactive pages will end up running in WebAssembly to provide the user with the best experience and the app with the highest scaling by leveraging client devices to minimize load on the web server.

You can still choose pure Blazor server or Blazor WebAssembly, or take advantage of the powerful new render mode capabilities.

We spend substantial time in the workshop covering the render modes, hosting options, and key decision points for each.

Inside the Session

What: Workshop: Building Blazor Applications

When: March 14, 8 a.m. - 5 p.m.

Who: Jason Bock, Staff Software Engineer, Rocket Mortgage, Allen Conway, Microsoft MVP, Azure App Modernization Consultant, Xebia, Rockford Lhotka, VP of Strategy, Xebia

Why: Leave with a comprehensive understanding of the Blazor landscape.

Find out more about VS Live! taking place March 10-14 at Paris Las Vegas Hotel & Casino

What advantages does Blazor offer for full-stack development compared to other frameworks?
By far, the main advantage of Blazor is that a .NET developer can use all the knowledge they have and apply it directly when building a Blazor application. With JavaScript-based front ends, there's a disconnect where you must use one language for the client, and another for anything needed in middleware. Blazor effectively removes that switch, and lets you be comfortable reusing skills and techniques you've built over the years using .NET.

Can you tease just one best practice for implementing authentication and authorization in Blazor applications that you will discuss in your presentation?
The key thing to understand is that on the server Blazor uses the underlying ASP.NET Core authentication technology that web developers have been using for decades. All of which ultimately exposes the user identity as a ClaimsPrincipal and ClaimsIdentity.

Blazor authorization provides some UI helpers that make use of the ClaimsIdentity for the current user to make it easy for developers to build compelling user experiences.

Blazor Hybrid and Blazor WebAssembly also use the ClaimsIdentity to support the same authorization features, but it is up the app developer to ensure that the user identity authenticated and provided to the Blazor authorization infrastructure.

Does Blazor stand up against mainstream JavaScript frameworks and libraries for creating modern web and hybrid applications?

Yes absolutely. Blazor as a technology stack has 5+ years tenure with .NET, extensive open-source support as well as a rising adoption in the global development community. Its modern architecture leveraging a mix of WebAssembly on the client and .NET technologies on the server provides a comprehensive approach to addressing a wide range of implementation needs and scenarios. From blazing fast client-side rendering in the browser leveraging modern data binding techniques, to server-side rendering for rapid initial loading and better SEO, Blazor can stand toe to toe and exceed modern JavaScript options available.

What resources would you recommend for developers to get up to speed with building Blazor applications and prepare for your session?
Both dotnet.microsoft.com and learn.microsoft.com are excellent starting blocks to learn about Blazor as a technology stack as well as getting your hands on the code and building a sample application. Starting from a blank slate and seeing the project templates within Visual Studio as well as working with the default demo application will provide a nice primer and context for coming to the workshop which will dive deeper into building Blazor applications.

Note: Those wishing to attend the conference can save hundreds of dollars by registering early, according to the event's pricing page. "Save $400 when you Register by the Super Early Bird savings deadline of Jan. 17," said the organizer of the event, which is presented by the parent company of Visual Studio Magazine.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Building Blazor Applications

    A trio of Blazor experts will conduct a full-day workshop for devs to learn everything about the tech a a March developer conference in Las Vegas keynoted by Microsoft execs and featuring many Microsoft devs.

  • Gradient Boosting Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the gradient boosting regression technique, where the goal is to predict a single numeric value. Compared to existing library implementations of gradient boosting regression, a from-scratch implementation allows much easier customization and integration with other .NET systems.

  • Microsoft Execs to Tackle AI and Cloud in Dev Conference Keynotes

    AI unsurprisingly is all over keynotes that Microsoft execs will helm to kick off the Visual Studio Live! developer conference in Las Vegas, March 10-14, which the company described as "a must-attend event."

  • Copilot Agentic AI Dev Environment Opens Up to All

    Microsoft removed waitlist restrictions for some of its most advanced GenAI tech, Copilot Workspace, recently made available as a technical preview.

  • Microsoft's New Cloudy Java: The Modern Web App Pattern and 'Strangler Fig'

    Having introduced its Modern Web Application (MWA) pattern for Java developers late last year, Microsoft is now promoting the cloud-centric concept further by highlighting the benefits of the "Strangler Fig" approach.

Subscribe on YouTube