ASP.NET-Identity limit UserName length
How can I limit the UserName field in the table AspNetUsers ? Neither this: public class ApplicationUser : IdentityUser { [Required, MaxLength(15)] public string UserName { get; set; } } or this: modelBuilder.Entity<ApplicationUser>().Property(x => x.UserName).HasMaxLength(15); works. I need this because setting an Index on an nvarchar(max) gives me this error msg: Column 'UserName' in table 'dbo.AspNetUsers' is of a type that is invalid for use as a key column in an index. To be verbose, I was trying to set the indexes like this: public override void Up() { CreateIndex("dbo.AspNetUsers",