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 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 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 MethodInfo behaves nicely as a key in a
>> dictionary. Not tested it yet :)
>>
>>
>>
>> On Thursday, August 9, 2018 at 2:03:58 PM UTC+1, Krzysztof Koźmic wrote:
>>>
>>> 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 optimisation. IIRC you'll get an interceptor instance per
>>> component instance, not per method, so one interceptor will apply to all
>>> methods on an instance (unless you exclude it with IInterceptorSelector).
>>>
>>> Hope that makes sense
>>>
>>>
>>> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to castle-project-users+unsubscr...@googlegroups.com.
> To post to this group, send email to castle-project-users@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/castle-project-users.
> For more options, visit https://groups.google.com/d/optout.
>
-- 

sent from my phone
Krzysztof

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to castle-project-users+unsubscr...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.
Visit this group at https://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.


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 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 MethodInfo behaves nicely as a key in a 
> dictionary. Not tested it yet :)
>
>
>
> On Thursday, August 9, 2018 at 2:03:58 PM UTC+1, Krzysztof Koźmic wrote:
>>
>> 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 optimisation. IIRC you'll get an interceptor instance per 
>> component instance, not per method, so one interceptor will apply to all 
>> methods on an instance (unless you exclude it with IInterceptorSelector).
>>
>> Hope that makes sense
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to castle-project-users+unsubscr...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.
Visit this group at https://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.


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 MethodInfo behaves nicely as a key in a 
dictionary. Not tested it yet :)



On Thursday, August 9, 2018 at 2:03:58 PM UTC+1, Krzysztof Koźmic wrote:
>
> 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 optimisation. IIRC you'll get an interceptor instance per 
> component instance, not per method, so one interceptor will apply to all 
> methods on an instance (unless you exclude it with IInterceptorSelector).
>
> Hope that makes sense
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to castle-project-users+unsubscr...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.
Visit this group at https://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.


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
optimisation. IIRC you'll get an interceptor instance per component
instance, not per method, so one interceptor will apply to all methods on
an instance (unless you exclude it with IInterceptorSelector).

Hope that makes sense

On Thu, 9 Aug 2018 at 14:18 'Jordan' via Castle Project Users <
castle-project-users@googlegroups.com> wrote:

> 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 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 which interceptors to use for the
>>> job?
>>>
>>> Sounds like you might want to have your interceptors implement
>>> IOnBehalfAware
>>> https://github.com/castleproject/Windsor/blob/master/docs/interceptors.md#ionbehalfaware-interface
>>> to let you inspect the component model implementation for your attributes
>>> there, cache the data and then apply appropriately during interception.
>>>
>>> On Thu, 9 Aug 2018 at 10:11 'Jordan' via Castle Project Users <
>>> castle-pro...@googlegroups.com> wrote:
>>>
 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
 attribute/interceptor.

 I want the Transaction attribute to have a couple of properties, eg
 System.Data.IsolationLevel and maybe a ReadOnly boolean which will be set
 on the interceptor so it knows how to configure the Transaction.

 many thanks,
 Jordan




 On Wednesday, August 8, 2018 at 7:42:07 PM UTC+1, Krzysztof Koźmic
 wrote:

> 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 DynamicProxy?
>
> On Wed, 8 Aug 2018 at 17:30 'Jordan' via Castle Project Users <
> castle-pro...@googlegroups.com> wrote:
>
 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" do you mean yes there is a better way to do this?
>> I'm a bit confused because your example doesn't configure the interceptor
>> for each call based on the properties of an attribute (or based on 
>> anything
>> else).
>>
>> Really really sorry if I've missed something obvious.
>>
>> Jordan
>>
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Castle Project Users" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to castle-project-users+unsubscr...@googlegroups.com.
>>
> To post to this group, send email to castle-pro...@googlegroups.com.
>
>
>> Visit this group at
>> https://groups.google.com/group/castle-project-users.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
>
> sent from my phone
> Krzysztof
>
 --
 You received this message because you are subscribed to the Google
 Groups "Castle Project Users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to castle-project-users+unsubscr...@googlegroups.com.
 To post to this group, send email to castle-pro...@googlegroups.com.
 Visit this group at
 https://groups.google.com/group/castle-project-users.
 For more options, visit https://groups.google.com/d/optout.

>>> --
>>>
>>> sent from my phone
>>> Krzysztof
>>>
>> --
>>
>> sent from my phone
>> Krzysztof
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to castle-project-users+unsubscr...@googlegroups.com.
> To post to 

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 method on a component that is being 
intercepted?

thanks,
Jordan.



So in the case of does target.Configuration.Attributes

On Thursday, August 9, 2018 at 12:23:13 PM UTC+1, Krzysztof Koźmic wrote:
>
> 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 
> https://github.com/castleproject/Windsor/blob/master/docs/interceptors.md#ionbehalfaware-interface
>  
> to let you inspect the component model implementation for your attributes 
> there, cache the data and then apply appropriately during interception.
>
> On Thu, 9 Aug 2018 at 10:11 'Jordan' via Castle Project Users <
> castle-pro...@googlegroups.com > wrote:
>
>> 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 
>> attribute/interceptor.
>>
>> I want the Transaction attribute to have a couple of properties, eg 
>> System.Data.IsolationLevel and maybe a ReadOnly boolean which will be set 
>> on the interceptor so it knows how to configure the Transaction.
>>
>> many thanks,
>> Jordan
>>
>>
>>
>>
>> On Wednesday, August 8, 2018 at 7:42:07 PM UTC+1, Krzysztof Koźmic wrote:
>>
>>> 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 DynamicProxy?
>>>
>>> On Wed, 8 Aug 2018 at 17:30 'Jordan' via Castle Project Users <
>>> castle-pro...@googlegroups.com> wrote:
>>>
>> 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" do you mean yes there is a better way to do this? 
 I'm a bit confused because your example doesn't configure the interceptor 
 for each call based on the properties of an attribute (or based on 
 anything 
 else).

 Really really sorry if I've missed something obvious.

 Jordan


  

 -- 
 You received this message because you are subscribed to the Google 
 Groups "Castle Project Users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to castle-project-users+unsubscr...@googlegroups.com.

>>> To post to this group, send email to castle-pro...@googlegroups.com.
>>>
>>>
 Visit this group at 
 https://groups.google.com/group/castle-project-users.
 For more options, visit https://groups.google.com/d/optout.

>>> -- 
>>>
>>> sent from my phone
>>> Krzysztof
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Castle Project Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to castle-project-users+unsubscr...@googlegroups.com .
>> To post to this group, send email to castle-pro...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/castle-project-users.
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
>
> sent from my phone
> Krzysztof
>

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to castle-project-users+unsubscr...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.
Visit this group at https://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.


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 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 which interceptors to use for the 
>> job?
>>
>> Sounds like you might want to have your interceptors implement 
>> IOnBehalfAware 
>> https://github.com/castleproject/Windsor/blob/master/docs/interceptors.md#ionbehalfaware-interface
>>  
>> to let you inspect the component model implementation for your attributes 
>> there, cache the data and then apply appropriately during interception.
>>
>> On Thu, 9 Aug 2018 at 10:11 'Jordan' via Castle Project Users <
>> castle-pro...@googlegroups.com > wrote:
>>
>>> 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 
>>> attribute/interceptor.
>>>
>>> I want the Transaction attribute to have a couple of properties, eg 
>>> System.Data.IsolationLevel and maybe a ReadOnly boolean which will be set 
>>> on the interceptor so it knows how to configure the Transaction.
>>>
>>> many thanks,
>>> Jordan
>>>
>>>
>>>
>>>
>>> On Wednesday, August 8, 2018 at 7:42:07 PM UTC+1, Krzysztof Koźmic wrote:
>>>
 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 DynamicProxy?

 On Wed, 8 Aug 2018 at 17:30 'Jordan' via Castle Project Users <
 castle-pro...@googlegroups.com> wrote:

>>> 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" do you mean yes there is a better way to do this? 
> I'm a bit confused because your example doesn't configure the interceptor 
> for each call based on the properties of an attribute (or based on 
> anything 
> else).
>
> Really really sorry if I've missed something obvious.
>
> Jordan
>
>
>  
>
> -- 
> You received this message because you are subscribed to the Google 
> Groups "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to castle-project-users+unsubscr...@googlegroups.com.
>
 To post to this group, send email to castle-pro...@googlegroups.com.


> Visit this group at 
> https://groups.google.com/group/castle-project-users.
> For more options, visit https://groups.google.com/d/optout.
>
 -- 

 sent from my phone
 Krzysztof

>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Castle Project Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to castle-project-users+unsubscr...@googlegroups.com 
>>> .
>>> To post to this group, send email to castle-pro...@googlegroups.com 
>>> .
>>> Visit this group at https://groups.google.com/group/castle-project-users
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> -- 
>>
>> sent from my phone
>> Krzysztof
>>
> -- 
>
> sent from my phone
> Krzysztof
>

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to castle-project-users+unsubscr...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.
Visit this group at https://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.


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 which interceptors to use for the
> job?
>
> Sounds like you might want to have your interceptors implement
> IOnBehalfAware
> https://github.com/castleproject/Windsor/blob/master/docs/interceptors.md#ionbehalfaware-interface
> to let you inspect the component model implementation for your attributes
> there, cache the data and then apply appropriately during interception.
>
> On Thu, 9 Aug 2018 at 10:11 'Jordan' via Castle Project Users <
> castle-project-users@googlegroups.com> wrote:
>
>> 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
>> attribute/interceptor.
>>
>> I want the Transaction attribute to have a couple of properties, eg
>> System.Data.IsolationLevel and maybe a ReadOnly boolean which will be set
>> on the interceptor so it knows how to configure the Transaction.
>>
>> many thanks,
>> Jordan
>>
>>
>>
>>
>> On Wednesday, August 8, 2018 at 7:42:07 PM UTC+1, Krzysztof Koźmic wrote:
>>
>>> 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 DynamicProxy?
>>>
>>> On Wed, 8 Aug 2018 at 17:30 'Jordan' via Castle Project Users <
>>> castle-pro...@googlegroups.com> wrote:
>>>
>> 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" do you mean yes there is a better way to do this?
 I'm a bit confused because your example doesn't configure the interceptor
 for each call based on the properties of an attribute (or based on anything
 else).

 Really really sorry if I've missed something obvious.

 Jordan




 --
 You received this message because you are subscribed to the Google
 Groups "Castle Project Users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to castle-project-users+unsubscr...@googlegroups.com.

>>> To post to this group, send email to castle-pro...@googlegroups.com.
>>>
>>>
 Visit this group at
 https://groups.google.com/group/castle-project-users.
 For more options, visit https://groups.google.com/d/optout.

>>> --
>>>
>>> sent from my phone
>>> Krzysztof
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Castle Project Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to castle-project-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to
>> castle-project-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/castle-project-users.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
>
> sent from my phone
> Krzysztof
>
-- 

sent from my phone
Krzysztof

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to castle-project-users+unsubscr...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.
Visit this group at https://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.


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
https://github.com/castleproject/Windsor/blob/master/docs/interceptors.md#ionbehalfaware-interface
to let you inspect the component model implementation for your attributes
there, cache the data and then apply appropriately during interception.

On Thu, 9 Aug 2018 at 10:11 'Jordan' via Castle Project Users <
castle-project-users@googlegroups.com> wrote:

> 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
> attribute/interceptor.
>
> I want the Transaction attribute to have a couple of properties, eg
> System.Data.IsolationLevel and maybe a ReadOnly boolean which will be set
> on the interceptor so it knows how to configure the Transaction.
>
> many thanks,
> Jordan
>
>
>
>
> On Wednesday, August 8, 2018 at 7:42:07 PM UTC+1, Krzysztof Koźmic wrote:
>
>> 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 DynamicProxy?
>>
>> On Wed, 8 Aug 2018 at 17:30 'Jordan' via Castle Project Users <
>> castle-pro...@googlegroups.com> wrote:
>>
> 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" do you mean yes there is a better way to do this? I'm
>>> a bit confused because your example doesn't configure the interceptor for
>>> each call based on the properties of an attribute (or based on anything
>>> else).
>>>
>>> Really really sorry if I've missed something obvious.
>>>
>>> Jordan
>>>
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Castle Project Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to castle-project-users+unsubscr...@googlegroups.com.
>>>
>> To post to this group, send email to castle-pro...@googlegroups.com.
>>
>>
>>> Visit this group at https://groups.google.com/group/castle-project-users
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>>
>> sent from my phone
>> Krzysztof
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to castle-project-users+unsubscr...@googlegroups.com.
> To post to this group, send email to castle-project-users@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/castle-project-users.
> For more options, visit https://groups.google.com/d/optout.
>
-- 

sent from my phone
Krzysztof

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to castle-project-users+unsubscr...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.
Visit this group at https://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.


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 
attribute/interceptor.

I want the Transaction attribute to have a couple of properties, eg 
System.Data.IsolationLevel and maybe a ReadOnly boolean which will be set 
on the interceptor so it knows how to configure the Transaction.

many thanks,
Jordan




On Wednesday, August 8, 2018 at 7:42:07 PM UTC+1, Krzysztof Koźmic wrote:
>
> 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 
> DynamicProxy?
>
> On Wed, 8 Aug 2018 at 17:30 'Jordan' via Castle Project Users <
> castle-pro...@googlegroups.com > wrote:
>
>> 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" do you mean yes there is a better way to do this? I'm 
>> a bit confused because your example doesn't configure the interceptor for 
>> each call based on the properties of an attribute (or based on anything 
>> else).
>>
>> Really really sorry if I've missed something obvious.
>>
>> Jordan
>>
>>
>>  
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Castle Project Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to castle-project-users+unsubscr...@googlegroups.com .
>> To post to this group, send email to castle-pro...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/castle-project-users.
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
>
> sent from my phone
> Krzysztof
>

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to castle-project-users+unsubscr...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.
Visit this group at https://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.


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
DynamicProxy?

On Wed, 8 Aug 2018 at 17:30 'Jordan' via Castle Project Users <
castle-project-users@googlegroups.com> wrote:

> 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" do you mean yes there is a better way to do this? I'm a
> bit confused because your example doesn't configure the interceptor for
> each call based on the properties of an attribute (or based on anything
> else).
>
> Really really sorry if I've missed something obvious.
>
> Jordan
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to castle-project-users+unsubscr...@googlegroups.com.
> To post to this group, send email to castle-project-users@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/castle-project-users.
> For more options, visit https://groups.google.com/d/optout.
>
-- 

sent from my phone
Krzysztof

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to castle-project-users+unsubscr...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.
Visit this group at https://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.


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" do you mean yes there is a better way to do this? I'm a 
bit confused because your example doesn't configure the interceptor for 
each call based on the properties of an attribute (or based on anything 
else).

Really really sorry if I've missed something obvious.

Jordan


 

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to castle-project-users+unsubscr...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.
Visit this group at https://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.


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 attribute.
>
> The attribute will have a few properties which will be then used to
> configure the interceptor (by setting the corresponding properties on it).
>
> The code in SelectInterceptors would check if the method has the
> attribute, if so get it, and then configure the appropriate interceptor and
> return it.
>
> If an interceptor is added to the container and marked as transient, will
> a new instance be created and passed to SelectInterceptors every time a
> method is called?
>
> I want to make sure this approach is safe in a multi user web environment
> where the services themselves (ie the candidates for interception) are
> stored in the container as singletons.
>
> Or is there a better approach?
>
> many thanks,
> Jordan.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to castle-project-users+unsubscr...@googlegroups.com.
> To post to this group, send email to castle-project-users@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/castle-project-users.
> For more options, visit https://groups.google.com/d/optout.
>
-- 

sent from my phone
Krzysztof

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to castle-project-users+unsubscr...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.
Visit this group at https://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.