the minimal default AutoQuery implementation
[Route("/projections/countries")]
public class FindCountries : QueryBase<Country>
{
public string NameStartsWith { get; set; }
}
produces a partial documentation page
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"id":0,"name":"String","displayName":"String"}
the correct/real output should be
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"Offset":0,"Total":0,"Results":[{"id":0,"name":"String","displayName":"String"}],"Meta":{"String":"String"},"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}
In order to get that output and to have it work through soap/wsdl, I have to do the following customization
[Route("/projections/countries2")]
[DataContract()]
public class FindCountriesSoap : IQuery<Country>, IReturn<FindCountriesSoapResponse>
{
[DataMember]
public string NameStartsWith { get; set; }
[DataMember(Order = 1)]
public virtual int? Skip { get; set; }
[DataMember(Order = 2)]
public virtual int? Take { get; set; }
[DataMember(Order = 3)]
public virtual string OrderBy { get; set; }
[DataMember(Order = 4)]
public virtual string OrderByDesc { get; set; }
[DataMember(Order = 5)]
public virtual string Include { get; set; }
[DataMember(Order = 6)]
public virtual Dictionary<string, string> Meta { get; set; }
}
[DataContract()]
public class FindCountriesSoapResponse : QueryResponse<Country>
{
public static FindCountriesSoapResponse Create(QueryResponse<Country> queryResponse)
{
var obj = new FindCountriesSoapResponse();
obj.Meta = queryResponse.Meta;
obj.Offset = queryResponse.Offset;
obj.Total = queryResponse.Total;
obj.Results = queryResponse.Results;
obj.ResponseStatus = queryResponse.ResponseStatus;
return obj;
}
}
plus adding a dedicated service
public class CountryServices : Service
{
public IAutoQuery AutoQuery { get; set; }
//Override with custom implementation
public object Any(FindCountriesSoap request)
{
var q = AutoQuery.CreateQuery(request, Request.GetRequestParams());
var queryResponse = AutoQuery.Execute(request, q);
return FindCountriesSoapResponse.Create(queryResponse);
}
}
I could understand the customozation for the soap/wsdl support, but at least the documentation should reflect the real output with no need to customize the mimimal implemtation (RequestDTO only)
in both case the documentation page does not describe the ResponseStatus type: it simply list it within the
QueryResponse type, but the type description is missing
QueryResponse<T> Parameters:
NAME PARAMETER DATA TYPE REQUIRED DESCRIPTION
Offset form int No
Total form int No
Results form List<T> No
Meta form Dictionary<string, string> No
ResponseStatus form ResponseStatus No