MacroAttribute 类 |
Senparc.Weixin SDK 官方教程《微信开发深度解析》已出版,支持中国开源事业,请【购买正版】!
《微信公众号+小程序》视频课程已经上线,【点击这里】学习!
NeuChar(纽插)已经上线,为开发者提供一站式跨平台管理枢纽,并可将应用入驻到 NeuChar 应用商店!新功能正在不断增加中,快来使用吧! https://www.neuchar.com
在线动态微信接口 Swagger WebApi 文档: https://weixin.senparc.com:8039
命名空间: Senparc.Weixin.Annotations
MacroAttribute 类型公开以下成员。
名称 | 说明 | |
---|---|---|
MacroAttribute | 初始化 MacroAttribute 类的一个新实例 |
名称 | 说明 | |
---|---|---|
Editable |
Allows specifying which occurrence of the target parameter becomes editable when the template is deployed.
| |
Expression |
Allows specifying a macro that will be executed for a source template
parameter when the template is expanded.
| |
Target |
Identifies the target parameter of a source template if the
MacroAttribute is applied on a template method.
|
名称 | 说明 | |
---|---|---|
Serialize |
序列化对象
(由 StackExchangeRedisExtensions 定义。) | |
ToHashEntries |
Serialize in Redis format
(由 RedisUtils 定义。) | |
ToJson |
把数据转换为Json格式(使用Newtonsoft.Json.dll)
(由 ObjectExtensions 定义。) |
[SourceTemplate, Macro(Target = "item", Expression = "suggestVariableName()")] public static void forEach<T>(this IEnumerable<T> collection) { foreach (var item in collection) { //$ $END$ } }
[SourceTemplate] public static void something(this Entity x, [Macro(Expression = "guid()", Editable = -1)] string newguid) { /*$ var $x$Id = "$newguid$" + x.ToString(); x.DoSomething($x$Id); */ }