Extend application user | Blazor (Blazor)
Add ApplicationUser partial class
- Open the solution that Radzen has generated with Visual Studio (or the
server
directory with Visual Studio Code). - Go to the
server\Authentication
directory. - Add a new file
server\Models\ApplicationUser.Custom.cs
with the following content.using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using System.Runtime.Serialization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; // Replace [ApplicationName] with the namespace of your Radzen application. namespace [ApplicationName].Models { public partial class ApplicationUser { public string Country { get; set; } } }
- Open the
server
directory in a terminal. - Run
dotnet ef migrations add Country -c ApplicationIdentityDbContext
. This will create an Entity Framework Core migration which at runtime will add aCountry
column to theAspNetUsers
table. It will store theCountry
property values.
If you haven’t installed the EF Core tools before that command will fail. Run
dotnet tool install --global dotnet-ef
to install them.
Extend the user management pages
In order to capture the values of the custom properties created in the previous step you have to update the user management pages.
Check the related article from our CRM application tutorial.