一款简单易用的基础网络通讯组件库。

WebApiAttribute 类

该自定义属性用于标记 Web API 方法。 继承自 RpcAttribute,用于实现远程过程调用的功能。 通过该属性,可以更便捷地将方法暴露为 Web API 服务。

Definition

命名空间: TouchSocket.WebApi
程序集: TouchSocket.WebApi (在 TouchSocket.WebApi.dll 中) 版本:3.0.0+ccaf96084d09f972257496d1dd63b8ba3c1e44f0
C#
[AttributeUsageAttribute(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
[DynamicMethodAttribute]
public sealed class WebApiAttribute : RpcAttribute
Inheritance
Object    Attribute    RpcAttribute    WebApiAttribute

构造函数

WebApiAttribute 使用Get函数的WebApi特性
WebApiAttribute(HttpMethodType) 构造函数,用于初始化WebApiAttribute对象并设置HTTP方法类型。
已过时。

属性

ClassCodeGenerator 类生成器
(继承自 RpcAttribute。)
Exceptions 异常提示
(继承自 RpcAttribute。)
GeneratorFlag 生成代码
(继承自 RpcAttribute。)
GenericConstraintTypes 生成泛型方法的约束
(继承自 RpcAttribute。)
InvokeKey 调用键。
(继承自 RpcAttribute。)
Method 请求函数类型。
MethodInvoke 是否仅以函数名调用,当为True是,调用时仅需要传入方法名即可。
(继承自 RpcAttribute。)
MethodName 重新指定生成的函数名称。可以使用类似“JsonRpc_{0}”的模板格式。
(继承自 RpcAttribute。)
Namespaces 生成代理时,额外的命名空间
(继承自 RpcAttribute。)
PropertyNames 获取或设置属性名称的字典。
(继承自 RpcAttribute。)
TypeIdWhen implemented in a derived class, gets a unique identifier for this Attribute.
(继承自 Attribute。)

方法

EqualsReturns a value that indicates whether this instance is equal to a specified object.
(继承自 Attribute。)
GetDescription 获取注释信息
(继承自 RpcAttribute。)
GetExtensionsMethodProxyCode 获取扩展的代理代码
(继承自 RpcAttribute。)
GetGenericConstraintTypes 获取生成的函数泛型限定名称。默认IRpcClient
(重写 RpcAttributeGetGenericConstraintTypes)
GetHashCodeReturns the hash code for this instance.
(继承自 Attribute。)
GetInstanceProxyCode 获取生成实体类时的代码块
(继承自 RpcAttribute。)
GetInterfaceProxyCode 获取接口的代理代码
(继承自 RpcAttribute。)
GetInvokeKey 获取调用键
(继承自 RpcAttribute。)
GetInvokeOption 获取调用配置
(继承自 RpcAttribute。)
GetMethodName 获取生成的函数名称
(继承自 RpcAttribute。)
GetParameters 根据指定的RPC方法获取参数信息。
(继承自 RpcAttribute。)
GetProxyParameterName 从类型获取代理名
(继承自 RpcAttribute。)
GetReturn 获取返回值
(继承自 RpcAttribute。)
GetRouteUrls 获取路由路径。

路由路径的第一个值会被当做调用值。

GetTypeGets the Type of the current instance.
(继承自 Object。)
IsDefaultAttributeWhen overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.
(继承自 Attribute。)
MatchWhen overridden in a derived class, returns a value that indicates whether this instance equals a specified object.
(继承自 Attribute。)
ToStringReturns a string that represents the current object.
(继承自 Object。)

扩展方法

Map
(由 Mapper 定义。)
Map
(由 Mapper 定义。)
MapTTarget
(由 Mapper 定义。)
ToJsonString 转换为Json
(由 SerializeConvert 定义。)

参见