尝试使用“改装”向控制器发送请求:
[HttpGet("api/users/{userId}/appointments")]
public async Task Get(Guid userId, [FromQuery] FilterRow[] filters = null) {}
使用此方法添加的接口:
[Get("/api/users/{userId}/appointments")]
Task<IEnumerable> Get([AliasAs("userId")] Guid userId, [AliasAs("filters")] FilterRow[] filters);
FilterRow:
public class FilterRow
{
public string FieldName { get; set; }
public string FilterValue { get; set; }
public FilterCondition FilterCondition { get; set; }
}
public enum FilterCondition
{
Equals = 0,
LessThan = 1,
LessThanOrEqual = 2,
GreaterThan = 3,
GreaterThanOrEqual = 4,
NotEquals = 5
}
试图添加RefitUrlParameterFormatter。但是格式函数具有与此对象不同的值。使用IFormattable解决了此问题,但即使这样,它仍无法正常工作(Controller没有获得任何值)