Hi,

answer below

Now:
var options = new ProxyGenerationOptions ();
options.Selector = selector;
X x = (X) generator.CreateClassProxy (typeof (X), options, myInterceptors);

Then:
var selectingInterceptor = new SelectingInterceptor (myInterceptors, selector);
X x = (X) generator.CreateClassProxy (typeof (X), selectingInterceptor);

Why is this hackish or adds complexity?

I remove:
- the requirement of a static or instance field (+ initialization)
re: I think static would be better, then you pay the price of initialization 
only once

- the requirement of having IInterceptorSelector in the
ProxyGenerationOptions (+ serialization, + Equals, + GetHashCode)
re: but I think PGO is where it belongs. Also if we codegen it, it would work 
slightly faster at runtime (no need to lookup the methodInfo, then lookup 
interceptors for the method) Also code for serialization and Equals and GHC is 
already there :)

Another thing is, that it'd be awkward: you'd have an array of interceptors in 
the proxy type, but keep only one interceptor in it, and all the call next 
logic would be duplicated in it.
It also adds an implicit contract: put any interceptors you like into the 
CreateClassProxy, or if you want to select some of them, wrap them with 
SelectingInterceptor. This is the kind of implicit contracts I hate Unity for.
We might add an overload that takes just a single SelectingInterceptor but I 
don't like the idea of adding another overload to every CreateXYZProxy method.

>From current implementation' perspective, your idea certainly introduces less 
>changes (virtually none, if we ditch the add-overloads idea), but in a longer 
>perspective, I think Selector on ProxyGenerationOptions would work better.
Also, sole implementation of SelectingInterceptor would be more complicated 
than adding support for IInterceptorSelector via code gen.

what do others think? is there a third way?

Best regards,
Fabian



CONFIDENTIALITY NOTICE
This message is intended exclusively for the individual or entity to which it 
is addressed. This communication may contain information that is proprietary, 
privileged, confidential or otherwise legally exempt from disclosure. If you 
are not the named addressee, you are not authorized to read, print, retain, 
copy or disseminate this message or any part of it. If you have received this 
message in error, please delete all copies of this message and notify the 
sender immediately by return mail or fax ATSI S.A.(+4812) 285 36 04.
Any email attachment may contain software viruses which could damage your own 
computer system. Whilst reasonable precaution has been taken to minimise this 
risk, we cannot accept liability for any damage which you sustain as a result 
of software viruses. You should therefore carry out your own virus checks 
before opening any attachments.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Development List" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to