cool, thanks.
W dniu 18 czerwca 2009 10:32 użytkownik Belvasis <[email protected]> napisał: > I tried it using the InterceptorSelector and it works fine. I did a test and > have reported it to donjon. > > Thanks > > 2009/6/18 Krzysztof Koźmic <[email protected]> >> >> sounds like a bug to me... >> Please create a test and report it to donjon. >> As a workaround you can try using InterceptorSelector. Check the >> method as you did in the hook, and if it's not the one you want to >> intercept, return null. >> >> Krzysztof >> >> 2009/6/17 Belvasis <[email protected]>: >> > Hi, >> > >> > i try to proxy a specific method of an already created object. So i >> > build an >> > ProxyGenerationHook - class >> > >> > and its ShouldInterceptMethod simply checks >> > >> > return memberInfo.Name.Equals("doStart", >> > StringComparison.Ordinal); >> > >> > after this i create the proxy: >> > >> > ITaskStartableInterceptor pTSInterceptor = >> > ServiceResolver.doResolveByType<ITaskStartableInterceptor>(); >> > if (pTSInterceptor != null) >> > { >> > ProxyGenerator pGen = new ProxyGenerator(); >> > ProxyGenerationOptions pGenOptions = new >> > ProxyGenerationOptions(new >> > TaskProxyGenerationHook()); >> > pResult = pGen.CreateInterfaceProxyWithTarget<ITask>(pResult, >> > pGenOptions, pTSInterceptor); >> > } >> > >> > If I start this, an exception is thrown: >> > >> > "The method "get_Definition" in Type >> > "ITaskProxy24b04ad20e1146f68e57a44a48a51c86" der Assembly >> > "DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, >> > PublicKeyToken=null" >> > has no implementation". >> > >> > If i leave the genOptions out of the CreateInterfaceProxyWithTarget - >> > Method >> > >> > pResult = pGen.CreateInterfaceProxyWithTarget<ITask>(pResult, >> > pTSInterceptor); >> > >> > everything works as expected. >> > >> > Has anyone an idea what i do wrong? >> > >> > Thanks, >> > >> > Belvasis >> > >> > > >> > >> >> > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
