.net core 统一参数验证
1、[Required(ErrorMessage = "用户Code不能为空")] public string Code { get; set; } 2、[Required(ErrorMessage = "用户年龄不能为空")] [Range(1, 100, ErrorMessage = "年龄必须介于1~100之间")] public int? Age { get; set; }
1、[Required(ErrorMessage = "用户Code不能为空")] public string Code { get; set; } 2、[Required(ErrorMessage = "用户年龄不能为空")] [Range(1, 100, ErrorMessage = "年龄必须介于1~100之间")] public int? Age { get; set; }