WCF Web Api optional parameters in UriTemplate
-
12-11-2019 - |
문제
How to declare optional parameters in UriTemplate in WCF Web Api ? For example :
[WebGet(UriTemplate = "?culture={culture}")]
HttpResponseMessage<IEnumerable<Contact>> GetAll();
I need culture to be optional parameter. If culture is not passed I want to receive null for that param.
PS. I don't want to create solution with multiple GetAll methods with different UriTemplates...
해결책
With the following method declaration culture parameter will be null
[WebGet(UriTemplate = "?culture={culture}")]
HttpResponseMessage<IEnumerable<Contact>> GetAll(string culture);
제휴하지 않습니다 StackOverflow