首页 > 其他分享 >模型特性

模型特性

时间:2023-02-10 16:12:55浏览次数:42  
标签:set decimal get DataType 模型 特性 public

DisplayFormat 特性用于显式指定日期格式:

[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
public DateTime ReleaseDate { get; set; }

System.ComponentModel.DataAnnotations 命名空间还提供格式特性

[Display(Name = "Release Date")]
[DataType(DataType.Date)]
public DateTime ReleaseDate { get; set; }

[Range(1, 100)]
[DataType(DataType.Currency)]
[Column(TypeName = "decimal(18, 2)")]
public decimal Price { get; set; }

 

标签:set,decimal,get,DataType,模型,特性,public
From: https://www.cnblogs.com/friend/p/17109307.html

相关文章