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 (create, read, update and delete) 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, the project item template is named Razor Component. In Rider, the project item template is named Blazor Component.
Good Practice: Remember that Blazor component filenames must start with an uppercase letter; otherwise, you will have compile errors!
-
...