我正在使用 ASP.NET WebApi ,在将结果发送到 JSON 时,是否可以在 ModelMetadata 上发送数据注释,例如 DisplayName 属性、 ShowInEdit 、 ShowInDispplay 和其他自定义属性以及 Fieldnmae 和值。
public class Role
{
public Role()
{
Users = new List<User>();
}
[ScafoldingColumn(false)]
public int RoleId { get; set; }
[DisplayName("Role Name")]
[Required]
[ShowForDisplay(true)]
[ShowForEdit(true)]
public string RoleName { get; set; }
[ShowForDisplay(true)]
public ICollection<User> Users { get; set; }
}
提前致谢