现在我的模型课中有类似的内容:
[Required]
public bool IsNullable { get; set; }
[Required]
[StringLength(255, ErrorMessage = "Default value is too long.")]
public string DefaultValue { get; set; }
我想拥有它,以便仅当isNullable为false时才需要DefaultValue。有没有办法做到这一点?我一直在寻找解决方案,但仍然找不到任何有用的方法。谢谢您的时间。