Re: Intercepting method calls with an IInterceptorSelector

2018-08-09 Thread Krzysztof Koźmic
It's been years but IIRC MetadataToken was a good key (name will work only if you don't overload your methods). On Thu, 9 Aug 2018 at 16:36 'Jordan' via Castle Project Users < castle-project-users@googlegroups.com> wrote: > ps - MethodInfo doesn't behave nicely as the key, but MethodInfo.Name

Re: Intercepting method calls with an IInterceptorSelector

2018-08-09 Thread 'Jordan' via Castle Project Users
ps - MethodInfo doesn't behave nicely as the key, but MethodInfo.Name does On Thursday, August 9, 2018 at 3:01:26 PM UTC+1, Jordan wrote: > > Brilliant thanks! It has all fallen into place now. > > I can cache the attributes for every method from the ComponentModel in a > dictionary using the

Re: Intercepting method calls with an IInterceptorSelector

2018-08-09 Thread 'Jordan' via Castle Project Users
Brilliant thanks! It has all fallen into place now. I can cache the attributes for every method from the ComponentModel in a dictionary using the MethodInfo as the key, and then retrieve them from the cache using invocation.Method when the interceptor is called. I am of course hoping that

Re: Intercepting method calls with an IInterceptorSelector

2018-08-09 Thread Krzysztof Koźmic
The ComponentModel will give your interceptor the information about the component so you can pre-cache whatever information you need to extract from the attributes (componentModel.Implementation will give you the type). Then in the Intercept you can quickly look that data up. It's a performance

Re: Intercepting method calls with an IInterceptorSelector

2018-08-09 Thread 'Jordan' via Castle Project Users
Great! Thanks. So given that each transaction on a single service may be configured differently, does the ComponentModel passed in tell me the method that is being intercepted? And If an interceptor is added to the container and marked as transient, will a new instance be created for each

Re: Intercepting method calls with an IInterceptorSelector

2018-08-09 Thread 'Jordan' via Castle Project Users
I am running my transactions at the application service level, not at the controller level. On Thursday, August 9, 2018 at 12:26:06 PM UTC+1, Krzysztof Koźmic wrote: > > Separately from that, if that's about ASP.NET MVC controllers, wouldn't > IActionFilter make more sense than using

Re: Intercepting method calls with an IInterceptorSelector

2018-08-09 Thread Krzysztof Koźmic
Separately from that, if that's about ASP.NET MVC controllers, wouldn't IActionFilter make more sense than using DynamicProxy? On Thu, 9 Aug 2018 at 13:22 Krzysztof Koźmic wrote: > Ah I see. So it's more about configuring the interceptors, rather than > selecting which methods to intercept and

Re: Intercepting method calls with an IInterceptorSelector

2018-08-09 Thread Krzysztof Koźmic
Ah I see. So it's more about configuring the interceptors, rather than selecting which methods to intercept and which interceptors to use for the job? Sounds like you might want to have your interceptors implement IOnBehalfAware

Re: Intercepting method calls with an IInterceptorSelector

2018-08-09 Thread 'Jordan' via Castle Project Users
Hello, Yes this is the context of Windsor as opposed to using just plain DynamicProxy. I am working on a MVC Web app with NHibernate 5.1.3. In the absence of an up to date NHibernate Facility I have created a very minimal OpenSessionInView implementation and a Transaction

Re: Intercepting method calls with an IInterceptorSelector

2018-08-08 Thread Krzysztof Koźmic
Hi, No need to apologise. Having re-read your question I think I misunderstood what you wanted to do. Can you elaborate on how you want to configure the interceptors with attributes? You mention a container, does that mean your question is in the context of Windsor as opposed to using just plain

Re: Intercepting method calls with an IInterceptorSelector

2018-08-08 Thread 'Jordan' via Castle Project Users
On Wednesday, August 8, 2018 at 4:16:53 PM UTC+1, Krzysztof Koźmic wrote: > > Yes, there is > http://kozmic.net/2009/02/14/castle-dynamic-proxy-tutorial-part-v-interceptorselector-fine-grained-control/ > Thanks for the reply! However, after one quick read I don't understand! By "Yes. there is"

Re: Intercepting method calls with an IInterceptorSelector

2018-08-08 Thread Krzysztof Koźmic
Yes, there is http://kozmic.net/2009/02/14/castle-dynamic-proxy-tutorial-part-v-interceptorselector-fine-grained-control/ On Wed, 8 Aug 2018 at 15:54 'gusgorman' via Castle Project Users < castle-project-users@googlegroups.com> wrote: > Hello, > > I want to mark methods for interception using an