That was it! Didn't know I needed it but now that I searched the wiki (http://stw.castleproject.org/Tools.DynamicProxy-Introduction.ashx) it makes sense -- gives my interceptor a chance to run either before or after actual invocation.
Thanks! --- Patrick Steele http://weblogs.asp.net/psteele On Mon, Aug 2, 2010 at 4:02 PM, André Werlang <[email protected]> wrote: > Hi! > > You're problably missing a call to Proceed(): > > public void Intercept(IInvocation invocation) > { > invocation.Proceed(); > } > []'s > 2010/8/2 Patrick Steele <[email protected]> >> >> I'm trying something with DP 2.2. It was just an experiment and I ran >> into a problem I can't seem to figure out. I've boiled things down to >> a minimum: >> >> public abstract class ProjectBase >> { >> public virtual bool IsDirty { get; set; } >> } >> >> public class MyProject : ProjectBase >> { >> public virtual string Path1 { get; set; } >> } >> >> public class SimpleInterceptor : IInterceptor >> { >> public void Intercept(IInvocation invocation) >> { >> } >> } >> >> ProxyGenerator generator = new ProxyGenerator(); >> var projectProxy = generator.CreateClassProxy<MyProject>(new >> SimpleInterceptor()); >> Console.WriteLine(projectProxy.IsDirty); >> >> I get a NullReferenceException when trying to access the IsDirty >> property. If I create the proxy without the (empty) interceptor, it >> works fine. >> >> What am I doing wrong? >> >> --- >> Patrick Steele >> http://weblogs.asp.net/psteele >> >> -- >> 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. >> > > > > -- > André F. Werlang > twitter.com/awerlang > programmernotfound.blogspot.com > > -- > 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]. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.
