Can ServiceStack operation naming convention be overriden?

送分小仙女□ 提交于 2019-12-13 14:42:21

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!