Closed yuwenhuisama closed 10 months ago
好的,这个加入后续开发计划中
Attribute匹配的功能已在2.1.1版本中添加,使用方式如下:
attr(POS TYPE)
POS
限定Attribute应用的位置,使用*
表示匹配任何位置
type
应用于类型上exec
应用于方法/属性/属性getter/属性setterpara x
应用于某个参数上,x
一般为整数,表示参数的位置,0
表示第一个参数,x
为*
时表示任意参数ret
应用于返回值上TYPE
为Attribute类型名称,匹配规则与普通类型匹配规则一致对应你上面的代码,Pattern部分可以改成:
public string? Pattern => "setter(int||string||float||bool||LPS.Common.Rpc.MailBox *) && attr(exec RpcWrappedPropertyAttribute)";
现有的Attribute代理织入方法需要显式地在程序集级别指定代理,但是如果是编写library用于给其他人使用的、实现了
IMo
的基础类,就还需要其他人也在他的程序集中声明,显得不是很方便。example:
现在只能在OnEntry里面再动态地读对应的Attribute来判断是否进行拦截,希望能增加一个能基于指定的Attributes对方法进行筛选匹配机制。