asp.netentity-frameworkasp.net-identity.net-core

What is the use of Normalized Email & UserName in .NET core IdentityUser Model?


When I use IdentityUser model in Asp.Net Identity with EntityFramework, it creates some standard fields in the database. All the fields are self explanatory except for the below two fields.

My doubts are:

  1. Why do we need these Normalized fields? Where does it get used?
  2. What is the purpose of persisting it in the database?

Solution

  • By my understanding, both fields are there for performance reasons. It's sort of explained in the following thread Normalization on UserName and Email causes slow performance and are used to validate the case insensitive uniqueness of the UserName and Email fields. They are persisted in the database in order be able to create index on them, thus making the lookups by the normalized user name and email sargable.

    There is no other reason or usage of these fields.