The problem was an overly complicated solution with a weird usage of DP and Windsor. I have refactored the code and no longer need to do what I was asking about.
Note taken though, will provide a test with my next problem! thanks, Seif 2011/1/9 Krzysztof Koźmic <[email protected]>: > Please post here an entire failing test so that we can diagnose the problem. > > Krzysztof > > On 06/01/2011 4:44 AM, Seif Attar wrote: >> >> Hello, >> >> Upgrading from DynamicProxy1 to DP2.5, and ran into a problem I can't >> suss out a solution for. >> >> I am not sure what the solution is so complicated, >> orderWebServiceProxyTarget is an object of the class .Net generates >> when adding Webservice reference, and so the class does not implement >> the IOrderWebService interface. >> >> The current code that works with DP1 is: >> >> public class OrderServiceViaWS : IOrderServiceFacade, >> IInitializable >> { >> public IOrderWebService OrderWebService { get; set; } >> public object orderWebServiceProxyTarget{get; set;} >> <--- injected with windsor :S >> >> public void Initialize() >> { >> >> Castle.DynamicProxy.Generators.AttributesToAvoidReplicating.Add( >> >> typeof(System.Security.Permissions.PermissionSetAttribute)); >> >> var generator = new ProxyGenerator(); >> >> OrderWebService = >> (IOrderWebService)generator.CreateProxy( >> >> typeof(IOrderWebService), new >> StandardInterceptor(), >> >> orderWebServiceProxyTarget); >> } >> ...... >> } >> >> I tried changing the initialize implementation to: >> { >> >> Castle.DynamicProxy.Generators.AttributesToAvoidReplicating.Add( >> >> typeof(System.Security.Permissions.PermissionSetAttribute));<-- >> got an exception which told me I need this >> >> var generator = new ProxyGenerator(); >> >> OrderWebService = >> >> (IOrderWebService)generator.CreateClassProxyWithTarget(typeof(OrderService), >> new[] { typeof(IOrderWebService) }, >> orderWebServiceProxyTarget, >> new ProxyGenerationOptions(), >> new StandardInterceptor()); >> } >> >> running the test now gives this exception: >> >> System.Reflection.TargetInvocationException : Exception has been >> thrown by the target of an invocation. >> ----> System.InvalidOperationException : There was an error >> reflecting type 'OrderService'. >> ----> System.InvalidOperationException : Cannot serialize member >> 'System.ComponentModel.Component.Site' of type >> 'System.ComponentModel.ISite', see inner exception for more details. >> ----> System.NotSupportedException : Cannot serialize member >> System.ComponentModel.Component.Site of type >> System.ComponentModel.ISite because it is an interface. >> >> All components are registered with xml, it's a very complex( I have >> other words I can use, but just in case the guy who wrote this is on >> the list!) solution that has confused me a lot (IOrderServiceFacade >> implenetaion with a dependency on another named IOrderFacade >> implmentation with a dependency on OrderService as an object that gets >> proxied to the interface), and I am not up to rewrting the whole thing >> at the moment, as there are quite a few services. >> >> Been a long day can't think straight! >> >> Any ideas on how to get rid of the previous exception? or maybe a hint >> in the right direction?? >> > > -- > 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.
