My dto’s are in a separate assembly without any reference to ServiceStack (I’m setting ServiceStack attributes dynamically). I would like ‘to do the same’ with IReturn interface (I want my generated client dto’s implementing this interface) and keep my dto project free from ServiceStack references.
How can I achieve this nicely (dynamically adding the interface does not seem a very a good idea … and requires external frameworks) ?
It’s impossible to add Interfaces to an existing .NET class, but even if it were it would defeat the purpose of the IReturn<T> and IReturnVoid interface markers which is to enable a Typed API for generic Service Clients, which would not be available at compile time if they were dynamically added.
ServiceStack DTOs only need to reference the dep and impl-free ServiceStack.Interfaces.dll, which allows your clients to have the minimum dependencies to be able to call any remote ServiceStack Service. I’d strongly recommend against trying to define your ServiceStack Service Contract without trying to reference ServiceStack.Interfaces, which will only result a less valuable and less knowledgeable Service Contract with no real gain which is contra to the goals of defining a rich Service Contract.