asp.net web api - How do I bind querystring parameters to an object with different property names? -




i have controller action following signature. add more parameters becoming more difficult manage i'm looking using single request object.

public async task<ihttpactionresult> getsearchresults( [fromuri(name = "p1")] string p1longname = null, [fromuri(name = "p2")] list<string> p2longname = null, [fromuri(name = "p3")] int? p3longname = null) {}   public async task<ihttpactionresult> getsearchresults([fromuri]searchrequest parameters) 

the problem, how should handle different parameters names, querystring parameter vs object property? tried adding attribute [datamember(name = "p1")] p1longname property of class didn't work. use request object resulting parameter binding , then, in action method, map class real property names seems add layer of unnecessary complexity.

how request object bind querystring parameters using different names?





wiki

Comments

Popular posts from this blog

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -

Asterisk AGI Python Script to Dialplan does not work -