While the default IdentityUser class results in a complex Id, I seek to add an additional simple Id-Type value for a user, for internal use, e.g. AutoIncrementing number.
The only idea I came up with was customizing the IdentityUser to add up a property for the same like:
public class MyUser : IdentityUser
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int MyUserNo { get; set; }
}
The same did succeed in shape of having the additional property of MyUserNo set up in the default AspNetUsers table. However, when I proceeded by implementing the Email Address Confirmation strategy for a new user, upon clicking the link received on the said user's email for the same purpose, instead of having the said account being confirmed and status of EmailConfirmed being Updated to True, I am facing the following error:
SqlException: Cannot update identity column 'MyUserNo'. System.Data.SqlClient.SqlCommand+<>c.b__122_0(Task result) System.Threading.Tasks.ContinuationResultTaskFromResultTask.InnerInvoke() System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, object state) System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref Task currentTaskSlot) Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteAsync(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary parameterValues, CancellationToken cancellationToken) Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
I sure am in need of the said autoincrementing id type Column and seek ahead to link the same with some other tables so as to record the user's id for any easy reference.
Any solution and/or more recommended advice?
Thanks in advance.