And how do you pretend to access those dynamic added properties? Maybe mixins would do the trick for you.
On 6 maio, 09:37, Thiago Padilha <[email protected]> wrote: > What I really wanted was the hability to change the behavior of an > entire class hierachy, look at this > :http://www.codeproject.com/KB/silverlight/pmgoodpractices.aspx. In > this article this is simulated by using custom TypeDescriptors. The > problem with this kind of approach is that the consuming code has to > inspect the type using the TypeDescriptor class. > I know that dynamic proxy main purpose is to allow AOP, but if it > was possible to add functionality to a type, entire frameworks could > be extended by it. So in the article's example, I could inject all the > behavior necessary to WPF using Windsor, and it would be independent > of TypeDescriptor's inspection > > 2010/5/6 Krzysztof Koźmic (2) <[email protected]>: > > > > > > > Currently DynamicProxy was not really built with extensibility in mind > > since it has very focused task. > > I'm looking at making this a tad easier in next version though. > > > Why do you want to add these properties? How do you want to implement > > them? > > Do you want to have that for all kinds of proxies? > > > On 6 Maj, 14:04, Thiago de Arruda <[email protected]> wrote: > >> I have been looking for a way to extend Castle's > >> Dynamic Proxy to allow me adding new properties on the dynamic > >> class generated by it. The only thing I found was the > >> 'Castle.DynamicProxy.Contributors.ITypeContributor' which allows you > >> to make additional changes to the 'System.Reflection.Emit.TypeBuilder' > >> before the type is actually built. However, these contributors are > >> created inline on virtual methods defined in each of the classes that > >> derive from' Castle.DynamicProxy.Generators.BaseProxyGenerator'. So > >> the only way I can think of making modifications to the generated > >> proxy are following these steps. > > >> 1-Implement a ITypeContributor that will add the additional > >> properties. > >> 2-Subclass each of the BaseProxyGenerator subclasses to insert the new > >> contributors by overriding the method that returns the contributors. > >> 3-Implement a IProxyBuilder from the scratch since the > >> 'DefaultProxyBuilder' creates their 'BaseProxyGenerator' classes by > >> directly instantiating the. > > >> Is there an easier way to modify the proxies generated? > > >> -- > >> 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 > >> athttp://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 > > athttp://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 > athttp://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.
