Learning .NET MAUI Blazor (1), what is Blazor?

Putting Blazor aside, let's take a look at the current technology stack for web development. This is currently the most commonly used front-end and back-end separation development model, which requires equipment and development . Of course, that's another matter!
insert image description here
注:上图只是为了说明问题,没有任何语言歧视!
前端工程师后端工程师全栈工程师

Then we develop various projects according to this model, and there will be some problems that may be encountered as follows:

  • The technology stack is complex.
    Doing a project requires two completely different languages ​​and frameworks. It is a burden both for the individual and the team!
  • Unable to reuse logic and code.
    The front-end and back-end codes need to be written separately, not to mention the increase in duplication of labor. When a modification is made on one end and the other end fails to update in time, a BUG is freshly released.
  • Front-end and back-end ecology cannot be shared
    Because of language problems, front-end and back-end ecological resources cannot be shared!
  • Increased collaboration costs
    Yes, if 一个不懂后端的前端VS 一个不懂前端的后端, it is simply a disaster!

What is Blazor

Let me make a digression first, Microsoft is an old 6, and the .Net Framework is not open source. After the new boss came to power, he launched an open source project of .Net Core. When it was updated to .Net Core 3.x, .Net Framework was also updated to 4.x. Suddenly found a problem, .NET Core also uses 4.x words. Isn’t that the same as the version number of .Net Framework? It’s not easy to distinguish, so I made one, 艰难的决定that is, the two versions are unified, and there will be no .Net Framework and .Net Core in the future. We all call him .NET 5, and now it's time for .Net 7. But this makes programmers miserable. .Net Framework, .Net Core, .Net 5/6/7. If you don't understand the reason, it's really hard to explain the complicated relationship between them.

well, let's get back to business:

.NET Blazor (hereinafter collectively referred to as Blazor) is a Web UI framework launched by .NET Core 3.0. If you are familiar with Vue, you will feel that they are very similar. After all, the underlying logic of modern front-end frameworks is basically the same (DOM difference update, responsive, componentized, etc.).

Blazor uses C# instead of JavaScript to write code, so we can use all the excellent features of the C# language such as static type checking, generics, Linq, async/await, and delicious syntactic sugar. But can C# code run on the browser? The answer is one word: 行!.

Two modes of Blazor

Blazor is divided into two modes, Blazor WebAssemblyand Blazor Server, when .Net 7 is released, MAUI can also use Blazor. This is a huge boon for multi-terminal development. When creating a project, we can choose from the following templates.

insert image description here

Blazor WebAssembly

This is a single-page application (SPA) framework that uses WebAssembly technology to run .NET code in a web browser without plug-ins, and access the full functionality of the browser through JavaScript.

Blazor Server

Host the Blazor component on the ASP.NET Core server, send UI events from the browser to the server through SignalR, and send the rendered component back to the client after the server finishes processing.

Advantages of Blazor

  • Build interactive web UIs using C# instead of JavaScript. Using the same language for front-end and back-end code, you can:
    • Accelerate application development.
    • Reduce the complexity of the build pipeline.
    • Simplify maintenance.
    • Leverage the existing .NET library ecosystem.
    • Let developers understand and work on client-side and server-side code.
  • Application logic and code sharing.
  • Improve productivity with Blazor reusable UI components provided by Blazor.
  • Works with all modern web browsers, including mobile browsers. Blazor uses web-based standards, with no plugins or transpilers.
  • Razor components can be hosted using Blazor Server or Blazor WebAssembly to take advantage of server or client-side rendering.

Disadvantages of Blazor

  • Currently not suitable for high concurrency scenarios
  • The popularity and support of WASM is not widespread enough
  • WASM mode package startup is slow
  • ecological problem. But there are already many excellent Blazor component frameworks

Summarize

The pros and cons of Blazor are just that. Microsoft's official documentation also makes it clearer. Whether to follow Microsoft's technical route and what the future prospects of Blazor are is temporarily unknown.
Reference: Counting Blazor, the three generations of Microsoft's grandparents and WebFormthe previous two generations no longer know where they are. As for how long Blazor can play, let us wait and see!SilverLightBlazor

Why? Didn't you mean MAUI Blazor? What about MAUI? Next time, next time we will talk about what MAUI is!

Guess you like

Origin blog.csdn.net/sd2208464/article/details/128365805