小编use*_*921的帖子

ASP.NET-Identity限制UserNameIndex长度

如何限制表AspNetUsers中的UserNameIndex UNIQUE索引?

我正在使用带有Mysql后端的ASP.NET身份,并且正在运行另一个实例:

Index column size too large. The maximum column size is 767 bytes.
Run Code Online (Sandbox Code Playgroud)

我试过了

modelBuilder.Entity<Secuser>().Property(x => x.UserName).HasMaxLength(100);
modelBuilder.Entity<Secuser>().Property(t => t.Id).HasMaxLength(100);
Run Code Online (Sandbox Code Playgroud)

我已经完成了所有标准:

public class Secuser : IdentityUser
 {
 [Required]
 public string FullName { get; set; }

 [Required]
 public string Address { get; set; }

 [Required]
 public string City { get; set; }

 [Required]
 public string Country { get; set; }

 [Required]
 public bool AgreeTermsOfServicePrivacyPolicy { get; set; }

 [Required]
 public string BasePath { get; set; }
}

[DbConfigurationType(typeof(MySqlEFConfiguration))]
public …
Run Code Online (Sandbox Code Playgroud)

mysql entity-framework ef-code-first entity-framework-6 asp.net-identity

7
推荐指数
1
解决办法
1169
查看次数