Using query string parameters to disambiguate a UriTemplate match

前端 未结 3 1641
萌比男神i
萌比男神i 2021-02-07 01:40

I am using WCF 4.0 to create a REST-ful web service. What I would like to do is have different service methods called based on query string parameters in the UriTemplate<

3条回答
  •  情话喂你
    2021-02-07 01:59

    According to This post, it is not possible, you would have to do something like:

    [OperationContract]
    [WebGet(UriTemplate = "people/driversLicense/{driversLicense}")]
    string GetPersonByLicense(string driversLicense);
    
    [OperationContract]
    [WebGet(UriTemplate = "people/ssn/{ssn}")]
    string GetPersonBySSN(string ssn);
    

提交回复
热议问题