How to remove unnecessary data from the user table when you check-in via Identity?

Doing autorizao from Identity. Created the user model, which is inherited from IdentityUser. And if the user specifies a UserName, I get an error that this field is required. But if I don't need this field in my model, how can that be?

I tried using user-validation, but to no avail.

PS Core 2.0
June 8th 19 at 17:10
1 answer
June 8th 19 at 17:12
That's just from the UserName to get rid of. IdentityUser is an implementation of the interface IUser. You can take the source Identity and change the interface IUser.

But you can try to block the UserName the email and deleted from the model database. Then, the idea is that the UserName does will not participate, but in practice did not check.
public class MyUser:IdentityUser
 [AlwaysValid] //Always valid
 [Map] //not mapim in EFCore
 public string UserName
 get => Email;
 set => Email = value;
 public class AlwaysValid : ValidationAttribute
 public override bool IsValid(object value) => true;

Tried that. It's still not working. Writes that User name " is invalid, can only contain letters or digits. - heloise13 commented on June 8th 19 at 17:15
and if? public override string UserName => Email; And remove the controller/the view/model view function mention of the UserName. - chaz commented on June 8th 19 at 17:18

Find more questions by tags C#.NET