是否可以覆盖ServiceStack操作的命名约定? [英] Can ServiceStack operation naming convention be overriden?

查看:83
本文介绍了是否可以覆盖ServiceStack操作的命名约定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为ServiceStack服务定义一个DTO类.服务堆栈使用基于类名称的约定,因此,如果我的类称为传输,则相应的服务将使用HTTP操作中使用的类型为传输"的公开元数据.

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.

但是我已经有了Transmission类-我的DTO对象将被映射到该类.为避免混淆,我想定义TransmissionRequest DTO(可能比后缀"Request"更好),但在公开的服务元数据中保留"Transmission".我找不到一种方法来覆盖ServiceStack约定,因此它会在各自的C#类之后调用在服务操作中公开的类型.

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?

推荐答案

请参见路由Wiki 中的"nofollow>自动路由生成策略自定义,删除或注入不同的自动路由生成策略的方法.

See the Auto-Route Generation Strategies in the Routing wiki for different ways of customizing, removing or injecting different auto-route generated strategies.

这篇关于是否可以覆盖ServiceStack操作的命名约定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆