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

Add support for ProxyEffectiveType #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gluck
Copy link

@gluck gluck commented Sep 6, 2011

Here's a patch to support an effective proxy type, different from the target proxy type.
I use this to proxy between close-to-identical types from 2 assemblies:

e.g. I've got a type IFoo in assembly 1, implemented by a 'foo' target, and I need a proxy of a similar type IFoo from assembly 2:

using A1 = Alias1::Acme;
using A2 = Alias2::Acme;
A2.Foo proxy = Generator.CreateInterfaceProxyWithTargetInterface(
    typeof(A1.Foo),
    fee,
    new ProxyGenerationOptions { ProxyEffectiveType = typeof(A2.Foo) },
    Interceptor);

Castle unit tests are OK, I added a bunch of specific ones to that feature, not yet pushed (they require an extra test assembly/project).
Let me know if the feature makes sense for Castle (and I can further clean it up / provide test cases) or if I should stick on a fork.

Thanks !

different types (with close to identical layouts).
@kkozmic
Copy link
Contributor

kkozmic commented Sep 9, 2011

So basically (if I understand it correctly) this is something more commonly named as duck typing?

I'm happy to consider this for the next version, but because it's a major new feature and we're already in release stabilisation mode for v3 I want to hold any major changes for current version.

Can you open a ticket in issue tracker for this and a discussion on castle-devel google group so that other people can have a say and add ideas about it as well?

cheers,
Krzysztof

@ghost
Copy link

ghost commented Nov 9, 2011

This is something that would be useful for us as well. I hope this is in the roadmap for the next version.

@kkozmic
Copy link
Contributor

kkozmic commented Nov 9, 2011

it's certainly not off the table, especially if someone wants to contribute time to work on this feature, as in provide production ready implementation, test it thoroughly and make sure it works in all scenarios

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

Successfully merging this pull request may close these issues.

2 participants