问题
I need to define a DTO class for a ServiceStack service. Service stack uses convention based on class names, so if my class is called Transmission, the corresponding service will use expose metadata with a type "Transmission" used in HTTP operations.
But I already have Transmission class - the one my DTO object will be mapped to. To avoid confusion I want to define TransmissionRequest DTO (probably something better than just "Request" suffix) but keep "Transmission" in exposed service metadata. I don't find a way to override the ServiceStack convention, so it calls types exposed in service operations after their respective C# classes.
Is there a way to override exposed types (e.g. using attributes) or this is hard wired convention that can't be customized?
回答1:
See the Auto-Route Generation Strategies in the Routing wiki for different ways of customizing, removing or injecting different auto-route generated strategies.
来源:https://stackoverflow.com/questions/20071180/can-servicestack-operation-naming-convention-be-overriden