Skip to content
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

CreateInterfaceProxyWithoutTarget and BaseTypeForInterfaceProxy-member #672

Open
WolfgangKluge opened this issue Nov 18, 2023 · 0 comments

Comments

@WolfgangKluge
Copy link

WolfgangKluge commented Nov 18, 2023

I want to create a proxy from an interface where some methods are already defined by a base class.

E.g.

public abstract class Base {
    public void Test() {}
}
public interface I {
    void Test();
    int Value { get; set; }
}

My proxy should look like that (without Test).

public class Proxy : Base, I {
    public int Value { get; set; }
}

But the proxy will always have it's own method Test (no matter what the return value from an IProxyGenerationHook is).

Then I tried to intercept this method as well and pass the arguments to the base class, but I'm not able to do that in an easy way (I think from here it's quite the same as #647).

So my question is: is there a way to filter the methods that have to be generated by the proxy builder (at least on those methods that are already defined by BaseTypeForInterfaceProxy)?


Another solution would be to modify the generated proxy code to something like

public class Proxy : Base, I {
    public new void Test() {
        base.Test();
    }
    public int Value { get; set; }
}

whenever Test should not be intercepted as of IProxyGenerationHook and there is such a method in one of the base types.

Is there a way to hook into the generation process (with more possibilities than now)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant