Although note that Message-based designs that ServiceStack promotes lend themselves to designing and backwards and forwards compatible DTO’s which don’t require versioning.
If you really wanted to support multiple versions within the same Web Application you would need to map the routes manually, e.g:
[Route("/v1/dogs")]
public class SearchDogsV1 {
public List<string> Fields { get; set; }
}
[Route("/v2/dogs")]
public class SearchDogsV2 {
public List<string> Fields { get; set; }
}
But this is not something I’d recommend since I consider it unnecessary and causes a lot of friction in a statically typed language.
when i search the dogs, i just want to get three properties, should i create another DTO, such as
class PartialDog{
string name;
string color;
string location;
}
Is AutoQuery support this? I skip a lot of document and mix some concepts…
There’s no support for partially populating a Response DTO, you’d need to look at the fields in request.Fields collection and use that to work out which fields you want to populate.