It's much more comfortable to have them generated to webpages. What auto-generation docs are you guys using?
2010/8/10 Krzysztof Koźmic <[email protected]> > plus you get xml docs on the interface if it wasnt obvious enough > /// <summary> > /// Encapsulates an invocation of a proxied method. > /// </summary> > public interface IInvocation > { > /// <summary> > /// Gets the proxy object on which the intercepted method is > invoked. > /// </summary> > /// <value>Proxy object on which the intercepted method is > invoked.</value> > object Proxy { get; } > ... > > > On 10/08/2010 9:12 PM, omer katz wrote: > > Is it invocation.Proxy? > It's pretty annoying that the API is not documented. > > 2010/8/10 Ken Egozi <[email protected]> > >> you've got (at least) two options at your disposal: >> a. the invocation object has a reference to the object it was running on >> (I don't remember the name of the reference by heart). you can then grab the >> dictionary from there using reflection >> a'. better yet, have the dictionary be an explicitly implemented >> interface, and get typed access for it in the interceptor, without polluting >> your entity's API >> b. you could also keep the dictionary on the interceptor instance (and >> make sure you have interceptor per entity and not as singleton) which will >> make accessing it a breeze. >> example for something similar can be seen here: >> http://daniel.wertheim.se/2010/02/05/getting-started-with-mongodb-using-json-net-and-castle-dynamic-proxy/ >> >> >> On Tue, Aug 10, 2010 at 12:20 PM, omer katz <[email protected]> wrote: >> >>> 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]<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. > > > -- > 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.
