0
說完拉着這個代碼庫:'FromHeaderAttribute' 不是一個屬性類
https://github.com/RedRiverSoftware/FromHeaderAttribute
看完這個:
https://river.red/binding-to-and-validating-http-headers-with-web-api-2/
我試圖改變這一點:
public IHttpActionResult EchoHeaders([RedRiver.FromHead.FromHeader]StandardHeaders headers)
這個:
public IHttpActionResult EchoHeaders([FromHeader]StandardHeaders headers)
很顯然,我需要把它添加到控制器類的頂部:
using FromHeaderAttribute.Sample.Models;
但我收到此錯誤:
'FromHeaderAttribute' is not an attribute class.
然而,看代碼(我沒有改變)'FromHeaderAttribute
'類明確地繼承'ParameterBindingAttribute
',它繼承'System.Attribute
'。
我缺少什麼能夠定義可用作參數屬性而無需指定整個名稱空間的屬性 - 就像'FromUri
'和'FromBody
'這樣的屬性?