It looks like there is still a lot of documentation that has service method implementations returning an object type. I thought this was “old school” for servicestack and the return type should be the return dto type?
We always recommend returning an
object type because the method return type is insignificant, it’s more important to annotate your APIs on its Request DTO with the
IReturn<T> interface marker which is what’s used by the metadata services to generate Add ServiceStack Reference DTOs, metadata UIs, etc. It’s also required to provide a typed generic API with all Service Clients and Service Gateways which is the recommended way to call internal or external Services.
Your service can also return mixed decorated HttpResult responses which as it doesn’t change the Response DTO body doesn’t change the service contract which needs to be declared using
IReturn<T>, thus to avoid changing the method signature later and confusion about which response type is used by your APIs it’s recommended to return
object and always annotate your APIs response type with
Of course as the method return type is insignificant you can use the Response DTO return type if preferred, but IMO doesn’t add any value.