Software:Blazor

From HandWiki
Short description: Web programming framework for C# and HTML
Blazor
Blazor.png
Original author(s)Microsoft
Developer(s).NET Foundation
Initial release2018; 6 years ago (2018)
Repositorygithub.com/dotnet/aspnetcore/tree/main/src/Components
Operating systemLinux, macOS, Windows
Included withASP.NET Core
TypeWeb framework
LicenseApache License 2.0
Websitedotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor

Blazor is a free and open-source web framework that enables developers to create interactive web user interfaces (UI) using C# and HTML.[1][2][3][4][5] It is being developed by Microsoft.

Overview

Six different editions of Blazor apps have been announced.

Blazor Server: These apps are hosted on an ASP.NET Core server process, with the UI defined using ASP.NET Razor syntax. Remote clients act as thin clients, meaning that the bulk of the processing load is on the server. The client's web browser downloads a small page and updates its UI over a WebSocket connection using SignalR. Blazor Server was released as a part of .NET Core 3.[6]

Blazor WebAssembly: Single-page apps that are downloaded to the client's web browser before running. The size of the download is larger than for Blazor Server, depends on the app, and the processing is entirely done on the client hardware. However, this app type enjoys rapid response time. As its name suggests, this client-side framework targets WebAssembly, as opposed to JavaScript (but they can be used together).[7]

Blazor PWA and Blazor Hybrid editions: The former supports progressive web apps (PWA). The latter is a platform-native framework (as opposed to a web framework) but still renders the user interface using web technologies (e.g. HTML and CSS).

Blazor Hybrid: Formerly known as Blazor Native,[6] this version of Blazor renders a user interface in a native platform-app using the underlying operating system's built-in HTML rendering engine.[8]

Blazor United: These apps will be a combination of both Blazor Server and Blazor WebAssembly and allow a "best of both worlds" solution where developers would be able to more finely tune the rendering mode. This approach would overcome the shortcomings of the potentially large up-front download that Blazor WebAssembly requires and the constantly open SignalR connection that Blazor Server requires. This version of Blazor is currently part of the .NET 8 roadmap and has not yet been released.[9]

Despite the confusion that the descriptions of ASP.NET and Blazor could generate, the latter focuses on the creation of web applications with the aim of using the C# programming language instead of the JavaScript language, which is commonly used in this type of application.[10]

With the release of .NET 5, Blazor has stopped working on Internet Explorer and the legacy version of Microsoft Edge.[11]

Example

The following example shows how to implement a simple counter that can be incremented by clicking a button:

<h1>Blazor code example</h1>
<p>count: @count</p>
<button @onclick="IncCount">Click to increment</button>

@code {
    private int count = 0;

    private void IncCount()
    {
        count++;
    }
}

See also

References

  1. Strahl, Rick (31 July 2018). "Web Assembly and Blazor: Re-assembling the Web". Self-published. https://weblog.west-wind.com/posts/2018/Jul/31/Web-Assembly-and-Blazor-Reassembling-the-Web. 
  2. Tomassetti, Federico (September 4, 2018). "Blazor: .NET in the Browser". Strumenta. https://tomassetti.me/blazor-net-in-the-browser/. 
  3. James, Mike (12 February 2018). "Blazor .NET In The Browser". Self-published. https://www.i-programmer.info/news/89-net/11539-blazor-net-in-the-browser.html. 
  4. Miller, Jonathan (September 2018). "C# in the Browser with Blazor". MSDN Magazine 33 (9). https://docs.microsoft.com/en-us/archive/msdn-magazine/2018/september/web-development-csharp-in-the-browser-with-blazor. 
  5. Roth, Daniel (22 March 2018). "Get started building .NET web apps that run in the browser with Blazor". ASP.NET Blog. Microsoft. https://devblogs.microsoft.com/aspnet/get-started-building-net-web-apps-in-the-browser-with-blazor/. 
  6. 6.0 6.1 Roth, Daniel (10 October 2019). "Blazor Server in .NET Core 3.0 scenarios and performance". Microsoft. https://devblogs.microsoft.com/aspnet/blazor-server-in-net-core-3-0-scenarios-and-performance/. 
  7. Roth, Daniel (19 May 2020). "Blazor WebAssembly 3.2.0 now available". Microsoft. What is Blazor WebAssembly?. https://devblogs.microsoft.com/aspnet/blazor-webassembly-3-2-0-now-available/#what-is-blazor-webassembly. 
  8. "ASP.NET Core Blazor Hybrid". https://learn.microsoft.com/en-us/aspnet/core/blazor/hybrid/?view=aspnetcore-7.0. Retrieved 2023-11-14. 
  9. "ASP.NET Core Dev Team Launches 'Blazor United' Push for .NET 8". https://visualstudiomagazine.com/articles/2023/02/03/blazor-united-plan.aspx. Retrieved 2023-02-13. 
  10. ".NET Framework Trends in 2021". https://aristeksystems.com/blog/top-3-dot-net-framework-trends-2021/#trend-3. Retrieved 2022-05-23. 
  11. Roth, Daniel (30 September 2020). "Updated Blazor browser support for .NET 5". Microsoft. https://github.com/dotnet/aspnetcore/issues/26475. 

Further reading

  • Web Development with Blazor: A hands-on guide for .NET developers to build interactive UIs with C#. Packt Publishing. 2021. ISBN 978-1800208728. 
  • Microsoft Blazor: Building Web Applications in .NET 6 and Beyond. Apress. 2021. ISBN 978-1484278444. 
  • Blazor WebAssembly by Example: A project-based guide to building web apps with .NET, Blazor WebAssembly, and C#. Packt Publishing. 2021. ISBN 978-1800567511. 
  • Blazor in Action. Manning Publications. 2022. ISBN 978-1617298646. 

External links