.WithParameters and .NET Backend
folks,
i can find out how use .withparameters javascript backend can't find example how use .net backend. suggestions?
here client code:
//client code
var devicetable = client.gettable<todoitem>();
var = new todoitem();
i.complete = true;
i.text = "just it";
i.rowkey = guid.newguid().tostring();
i.partitionkey = "444";
var dic = new dictionary<string, string> { { "one", "1" }, { "two", "2" } };
devicetable.withparameters(dic);
await devicetable.insertasync(i);
//server code
public async task<ihttpactionresult> posttodoitem(todoitem item)
{
try
{
// suggestions withparameters data?
todoitem current = await insertasync(item);
return createdatroute("tables", new {id = current.id}, current);
}
catch (exception ex)
{
throw;
}
}
thanks in advance,
ryan
hi ryan,
since .net controllers web api controllers, can uri , query parameters via this.request.requesturi.query. can parsed key/value pairs using httputility.parsequerystring, or other means. don’t have request.parameters analog .net runtime since isn’t needed.
you can use httprequestmessageextensions.getquerynamevaluepairs method
“gets parsed query string collection of key-value pairs.”
or simply
namevaluecollection nvc = request.requesturi.parsequerystring();
jeff sanders (msft)
@jsandersrocks - windows store developer solutions @wsdevsol
getting started windows azure mobile services development? click here
getting started windows phone or store app development? click here
team blog: windows store & phone developer solutions
blog: http client protocol issues (and other fun stuff support)
Microsoft Azure > Azure Mobile Apps
Comments
Post a Comment