|
[HttpGet]
public object Get()
{
var skip = Convert.ToInt32(Request.Query["$skip"]);
var top = Convert.ToInt32(Request.Query["$top"]);
};
} |
Hi tanks for your answer. I'm sorry but my english in not very fluent and maybe the question is not well exposed. I know how read a query string, my question is about the name of variables because to use the FromQuery option in asp.net c# the name of variable must be the same as the parmaeter in the query string and is impossible to declare a variable who start with $.
Thanks
Stefano Capobianco
in c# it's impossible to declare a variable withe the name starting with th $ character. To use the FromQuery options in a mvc webapi controller the name of variable need to be the same as the variable passed as parameters:
Mvc controller declaration: public IActionResult methodname ([FromQuery] string variablename)
Url with parameter: http://hostname/api/values?variablename=variablevalue.
I would like to know if the name of the variable sent by a datamanager with the webapiadaptor need to start with the $.
I know that i can read the values with the querystring function but to have the code muche clean i would like to use the fromquery option.
Thanks and best regards in advance
Stefano Capobianco
| convertToQueryString: function (req, query, dm) { var res = [], tableName = req.table || ""; delete req.table; if (dm.dataSource.requiresFormat) req["$format"] = "json"; for (var prop in req) res.push(prop + "=" + req[prop]); res = res.join("&"); if (dm.dataSource.url && dm.dataSource.url.indexOf("?") !== -1 && !tableName) return res; debugger; res=res.replace(/[$]/g,"").replace(/select/,"$select"); return res.length ? tableName + "?" + res : tableName || ""; }, |