So I've gotten this far:

> internal class LookupPropertyInterceptor : IInterceptor
>
> {
>
>     public void Intercept(IInvocation invocation)
>
>     {
>
>         if (invocation.Method.Name.StartsWith("set_", 
> StringComparison.OrdinalIgnoreCase)
> &&
>
>         invocation.Method.GetCustomAttributes(typeof(LookupProperty), 
> true).ToList().Count
> == 1)
>
>         {
>
>            var property = ((LookupProperty)
> invocation.Method.GetCustomAttributes(typeof(LookupProperty), true
> ).ToList()[0]); // Handle property here
>
>         }
>
>         if (invocation.Method.Name.StartsWith("get_", 
> StringComparison.OrdinalIgnoreCase)
> &&
>
>         invocation.Method.GetCustomAttributes(typeof(LookupProperty), 
> true).ToList().Count
> == 1)
>
>         {
>
>                 var property = ((LookupProperty)
> invocation.Method.GetCustomAttributes(typeof(LookupProperty), true
> ).ToList()[0]); // Handle property here
>
>         }
>
>         invocation.Proceed();
>
>     }
>
> }
>
Now how do I handle the setting and getting to the dict dictionary from the
source object?

 2010/8/10 Ken Egozi <[email protected]>

> while intercepting you have access to the intercepted MethodInfo.  from
> there to the attributes set on that method the road is clear
>
>   On Tue, Aug 10, 2010 at 11:26 AM, omer katz <[email protected]> wrote:
>
>>   Hello,
>> I am reading Krzysztof Koźmic's tutorial about Dynamic Proxy and I can't
>> figure out how to intercept all properties that have some custom attribute.
>>
>> Example:
>>
>>>  [
>>> Entity("MyEntityName")]
>>>
>>> public class MyEntity
>>>
>>> {
>>>
>>>     private Dictionary<string, object> dict = new Dictionary<string,
>>> object>();
>>>
>>>     [
>>> LookupProperty("SomeOtherEntityName")]
>>>
>>>     public virtual SomeOtherEntity SomeOtherEntity { get; set; }
>>>
>>> }
>>>
>>  In the end result I would like SomeOtherEntity to access the dict
>> dictionary with "SomeOtherEntityName" as the key.
>>
>> Is it possible? How can it be done?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Castle Project Users" group.
>> To post to this group, send email to
>> [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<castle-project-users%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/castle-project-users?hl=en.
>>
>
>
>
> --
> Ken Egozi.
> http://www.kenegozi.com/blog
> http://www.delver.com
> http://www.musicglue.com
> http://www.castleproject.org
> http://www.idcc.co.il - הכנס הקהילתי הראשון למפתחי דוטנט - בואו בהמוניכם
>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To post to this group, send email to [email protected]
> .
> To unsubscribe from this group, send email to
> [email protected]<castle-project-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/castle-project-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" 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-users?hl=en.

Reply via email to