IdentityUser 的用户名 属性 的默认 DataAnnotations 是什么?
What are the default DataAnnotations for IdentityUser's UserName property?
IdentityUser
的 UserName
属性 的默认值 DataAnnotations
是多少?我找不到他们。
我想知道,因为我想覆盖 属性 以将更多 DataAnnotations
添加到 属性,但是覆盖后所有旧的 DataAnnotations
都将丢失.我需要知道将它们添加到被覆盖的 属性.
中的那些
在默认框架实现中 Username
上没有数据注释:
public class IdentityUser<TKey, TLogin, TRole, TClaim> : IUser<TKey>
where TLogin : IdentityUserLogin<TKey>
where TRole : IdentityUserRole<TKey>
where TClaim : IdentityUserClaim<TKey>
{
/// <summary>
/// Constructor
/// </summary>
public IdentityUser()
{
Claims = new List<TClaim>();
Roles = new List<TRole>();
Logins = new List<TLogin>();
}
/// SNIP
/// <summary>
/// User ID (Primary Key)
/// </summary>
public virtual TKey Id { get; set; }
/// <summary>
/// User name
/// </summary>
public virtual string UserName { get; set; }
}
IdentityUser
的 UserName
属性 的默认值 DataAnnotations
是多少?我找不到他们。
我想知道,因为我想覆盖 属性 以将更多 DataAnnotations
添加到 属性,但是覆盖后所有旧的 DataAnnotations
都将丢失.我需要知道将它们添加到被覆盖的 属性.
在默认框架实现中 Username
上没有数据注释:
public class IdentityUser<TKey, TLogin, TRole, TClaim> : IUser<TKey>
where TLogin : IdentityUserLogin<TKey>
where TRole : IdentityUserRole<TKey>
where TClaim : IdentityUserClaim<TKey>
{
/// <summary>
/// Constructor
/// </summary>
public IdentityUser()
{
Claims = new List<TClaim>();
Roles = new List<TRole>();
Logins = new List<TLogin>();
}
/// SNIP
/// <summary>
/// User ID (Primary Key)
/// </summary>
public virtual TKey Id { get; set; }
/// <summary>
/// User name
/// </summary>
public virtual string UserName { get; set; }
}