-
Notifications
You must be signed in to change notification settings - Fork 470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support "with" for record proxies #671
Comments
AFAIK, C# 9's Which means that your proxy interceptor needs to intercept these calls. When intercepting This will only work if the C# compiler chooses to mark the Note also that the |
I actually attempted going this way. The problem I got is that I didn't manage to transfer the mixin from the old object to the new without recreating it from scratch. There's no methods to retrieve the mixins like there's a way to retrieve a target. And when attempting to attach the proxied mixin I just got an exception. |
Could you add a mixin to your proxies that returns the mixins that you added to them? |
That's one hell of a workaround =) That would probably work, although that's really hacky... |
Is it possible to have support for the
with
syntax for proxies?I want to "enrich" my existing record with a mixin implementing a custom property, and make it persist across modifications of that record.
Unfortunately, it seems that when I use the
with
keyword, the proxy is gone and I end up with a completely new object.At the same time, if I do the same thing manually, aka
Example 1
Or even:
Example 2
The mixed in property is preserved when using
with
keyword, because the actual underlying class is preserved when using thewith
keyword.Unfortunately, it seems not to be the case for proxies.
Is there a way to achieve something similar to that but completely in runtime with DynamicProxy?
The text was updated successfully, but these errors were encountered: