Closed ExusAltimus closed 1 year ago
I have a scenario where the attribute I want on the proxy's property is not being replicated over from a mixin.
Sounds like a reasonable request, even though it may be an edge case.
Also it would be nice if we could also apply Attributes to proxy members and not only the class
In my opinion, that doesn't fit DynamicProxy's purpose very well. DynamicProxy's main goal is to provide you with a (programmable) instance of some type, not to derive arbitrarily modified types at runtime. Changing a type at the method level isn't something you can currently do with DynamicProxy (IIRC).
That said, I'll grant you that DynamicProxy's public API for handling custom attributes is pretty coarse-grained.
I have a scenario where the attribute I want on the proxy's property is not being replicated over from a mixin. The attribute itself is sealed and I can't modify the AttributeUsage to set Inherited to false.
The feature itself was considered once before in https://github.com/castleproject/Core/blob/d88e94447150996973d947a150ffda5efc0c3c1c/src/Castle.Core/DynamicProxy/Internal/AttributeUtil.cs#L119 Quoting the comment
Also it would be nice if we could also apply Attributes to proxy members and not only the class using ProxyGenerationOptions :>)