2014-01-24 26 views
0

在ASP.NET的Web API,我有一個動作方法,看起來像這樣:如何使用HyprLinkr處理可空參數?

[GET("?{optionalValue:int?}"), HttpGet] 
    public HttpResponseMessage Search(int? optionalValue = null) 

我如何做一個鏈接,沒有optionalValue參數,使用hyprlinkr?

嘗試:

linker.GetUri<MyController>(c => c.Search(null).ToString() 

會拋出一個NullReferenceException,同樣不

linker.GetUri<MyController>(c => c.Search(new int?()).ToString() 

TIA

回答

0

可空,似乎與最新版本HyprLinkr的1.0.1,只需使用支持:

linker.GetUri<MyController>(c => c.Search(new int?()).ToString()