문제

In ASP.NET Web API, I have a action method, that look like this:

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

How do I make a link, without the optionalValue parameter, using hyprlinkr?

Tried:

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

which throws a NullReferenceException, the same does

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

TIA

도움이 되었습니까?

해결책

Nullable seems to be supported with the latest version 1.0.1 of HyprLinkr, just use:

linker.GetUri<MyController>(c => c.Search(new int?()).ToString()
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top