Building components using Blazor
In this section, we will build a component to list, create, and edit customers in the Northwind database.
We will build it over several steps:
- Make a Blazor component that renders the name of a country set as a parameter.
- Make it work as a routable page as well as a component.
- Implement the functionality to perform CRUD operations on customers in a database.
Defining and testing a simple Blazor component
We will add the new component to the existing Blazor Web App project:
- In the
Northwind.Blazor
project, in theComponents\Pages
folder, add a new file namedCustomers.razor
. In Visual Studio 2022, the project item template is named Razor Component. In JetBrains Rider, the project item template is named Blazor Component.Good Practice: Blazor component filenames must start with an uppercase letter, or you will have compile errors!
- Add statements to output a heading for...