Home Multi-App Support For Asp.Net Identity – Part 3
Post
Cancel

Multi-App Support For Asp.Net Identity – Part 3

Add Fields to User Table

Now I would like to add 3 fields to the AspNetUser that will be created for us. In addition to the login information, I would like to add a First Name field, Last Name field, and an Employee Number field to the table.

For simplicity sake, I would just want all the new fields to be nvarchar(128) fields in the database and have the First Name and Last Name be “NOT NULL”

Lets get the file we need to update.

Grab the IdentityModels.cs file and look for the ApplcationUser class.

Alt text

Now add the 3 new fields as properties to the ApplicationUser class.

Alt text

Notice the Data Annotations. In order to use those we need to add the Data Annotations using statement:

Alt text

The [Required] annotation will make sure our database field is NOT NULL. Also, the [MaxLength] annotation, along with the string type, will create our field as an nvarchar with a length of 128 characters.

Next I want to create a new table that will house our Applications information.

This post is licensed under CC BY 4.0 by the author.