是否可以覆盖ServiceStack操作的命名约定?

编程入门 行业动态 更新时间:2024-10-10 09:17:07
本文介绍了是否可以覆盖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操作的命名约定?

本文发布于:2023-11-12 10:08:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1581185.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:操作   ServiceStack

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!