Calling AutoQuery requests internally

A quick question about leveraging AutoQuery requests internally using the service gateway.

In this exmple…

public class QueryRockstars : QueryDb<Rockstar> {}
...
http://localhost/rockstars?Id=bowie

the QueryRockstars DTO does not actually contain a property Id. If inside my application I have a need to fetch Rockstars, how can I cleanly execute the QueryRockstars request without being able to set the Id field?

One solution could be to use the internal DTO generation, but it can get messy with the proper verbs and correctly calling GET vs Get/Any methods, and it means calling it with the URL syntax intead of neatly assigning properties of the query DTO.

var reqpath = HostContext.ServiceController.GetRestPathForRequest("GET", restPath);
var reqDTO = reqpath.CreateRequest(reqpath, qsList, null);

Other options?

If you want to be able to query by Id property you should just add it to your Request DTO:

public class QueryRockstars : QueryDb<Rockstar> 
{
    public string Id { get; set; }
}

Otherwise you can provide a Custom AutoQuery implementation and add any additional parameters that way, e.g:

public class MyQueryServices : Service
{
    public IAutoQueryDb AutoQuery { get; set; }

    //Override with custom implementation
    public object Any(QueryRockstars query)
    {
        Dictionary<string,string> queryArgs = Request.GetRequestParams();
        queryArgs["Id"] = "bowie";    
        var q = AutoQuery.CreateQuery(dto, queryArgs, Request);
    }
}