(1/30) Everyone learns Blazor together: First meeting Blazor

(1/30) Everyone learns Blazor together: First meeting Blazor

The author has not been in contact with the software industry for a long time and has been exposed to three architectures

最后更新 12/9/2021 10:35 PM
StrayaWorker
预计阅读 4 分钟
分类
Blazor
专题
Learn the Blazor series together
标签
.NET C# ASP.NET Core Blazor architecture design

The author has not been in contact with the software industry for a long time. He has been in contact with three architectures, namely ASP.NET MVC, ASP.NET Core & Blazor, and ASP.NET Core & Angular. Since ASP.NET MVC was a newcomer to the software industry, I completed the project in a daze under the leadership of my predecessors, so I didn't have much insight. I just had a rough understanding of the differences between the front and back ends. The front end sends an HTTP Request to retrieve data from the back end, and the back end sends the data back, and then presents the results on the page.

By the end of the project, the supervisor pushed for the transformation to switch to ASP.NET Core & Blazor and assigned the author to make a template. The author searched Internet resources and pieced together to find a suitable architecture. At that time, he only felt that there was a big gap between Blazor and ASP.NET MVC. The front end did not require weak types of JavaScript, and the front and back ends were both strong types, which was of great help to my lazy personality. Unfortunately, due to customer needs, I had to switch to ASP.NET Core & Angular. There is no way to delve into Blazor.

However, if you lose, you will always gain. Under the high-pressure intensity of the new project and the guidance of my colleagues, I have a general understanding of Angular's Module, Component hierarchical architecture, and Observable-like Ajax-like concepts. Although I still have a partial understanding, I am also roughly familiar with Angular. I found that the concept of Component is similar to Blazor's, which can be said to have the same goal.

Since the purpose of my participation in the Ironman Race is to record my experiences, the descriptions in some places will be more cumbersome. In addition, I do not have rich experience in the software industry. If the content of my article is incorrect, please do not hesitate to enlighten me.

This time, I want to use Blazor to complete a website where users can enter their logs. It is expected that the projects covered will include:

  1. Introduction to Blazor
  2. Blazor Server, Blazor WebAssembly 2 Hosting models and project structures
  3. Introduction to Component, Event Handling
  4. ASP.NET Core
  5. EF Core
  6. Login, authorization

Blazor is written in C#. Although it can also be written in VB and F#, I am only familiar with C#. C#belongs to the. NET framework, and the. NET framework is more convenient to develop in Visual Studio, so I will use Visual Studio to develop it, and the version is. NET 5. Regarding the differences between ASP.NET,. NET Framework, and NET Core, I have previously seen someone elaborate on them and find it very helpful. If time permits, I will share them again. In addition, I will use git as a version control tool during the process, and the final program code will be placed on github.

GitHub link

Visual Studio download Link

** Note: The code in this article is refactored through. NET 6 + Visual Studio 2022. You can click on the original link to compare and learn the refactored code. Thank you for reading and support the original author **

Keep Exploring

延伸阅读

更多文章
同分类 / 同标签 12/25/2021

(29/30) Everyone learn Blazor together: Blazor unit testing

Probably the most boring process of developing a system is to solve bugs, especially the error of trying to value null objects (`Object reference not set to an instance of an object.`). This should be the most common problem that most people encounter when they first step into the programming field. In order to relieve themselves from the boring process of solving bugs, this article introduces 'unit testing'.

继续阅读
同分类 / 同标签 12/25/2021

(28/30) Everyone learns Blazor together: Policy-based authorization

It was mentioned before that 'ASP.NET Core Identity' uses 'Claim' based authentication. In fact,'ASP.NET Core Identity' has different types of authorization methods, the simplest are 'login authorization','role authorization', and 'Claim authorization', but all of the above are implemented in one way: 'Policy-based authorization'.

继续阅读