castle-dynamicproxy

Can I specify to Castle Windsor which virtual methods to override in a class proxy?

I have many virtual methods in a class, but only one should be intercepted, Can I tell Castle Windsor to override only that method so I dont have to do validation in the Intercept method? Edit: I use the IKernelEvents.ComponentRegistered event to choose which types get the interceptor. ...

Tests run in Gallio / MbUnit fail; unable to load Castle DynamicProxy

I have a .NET 3.5 assembly covered by around 4000 MbUnit tests. I hve been running these using the mbunit.cons.exe program with no trouble. Now I am trying to switch to Gallio (mbunit.cons.exe started blowing up with an 'out of memory' exception when producing the XML report). When running the tests in Icarus, most of them fail with th...

Castle DynamicProxy : How to Proxy Equals when proxying an interface ?

I need to use Castle DynamicProxy to proxy an interface by providing an instance of it to ProxyGenerator.CreateInterfaceProxyWithTarget. I also need to make sure that calls to Equals, GetHashCode and ToString hits the methods on the concrete instance, that I am passing, and I can't get that to work. In other words, I'd like this small ...

Event Interception with Castle DynamicProxy

Hi, In googling I can't seem to find an example of intercepting event on a proxied type and it doesn't seem to be working for me. Is there a way I can do this (ie. use an IInterceptor when an event is invoked)? Thanks. ...

Castle Interceptor Live Cycle and Memory Leak

Hello all, im new to castle dynamic proxy, and a bit curious.. when creating proxy of my object i save all the original value of its property on the interceptor (class scope) using dictionary and return the new value. now i wandering, when will this data get collected by GC?? can i control it or depends on the interceptor live cycle? ...

Register multiple interceptors in castle windsor fluent

How do I register multiple interceptors using the fluent API? ...

Overridding GetHashCode and Equals in Castle Dynamic Proxy 2.1 IModelInterceptorsSelector

I've read that in order to get caching and push performance when using an Interceptor Selector when using Castle Dynamic Proxy that I need to override GetType(), GetHashCode() and Equals() Where can I find an example of or what would be the best, from a performing perspective, implementation? ...

Prevent methods from being intercepted - castle

Hi All When I assign an interceptor to the component when registering it (interface based), every method that is part of the interface contract gets intercepted. Is there a way prevent a method from being intercepted an attribute or something? Thanks ...

How can I create a DynamicProxy for a WCF proxy that is generated by ChannelFactory<T>?

I am using ChannelFactory to create a proxy at run-time for a WCF service. I would like to use the DynamicProxy Castle project to create a dynamic proxy on top of the WCF proxy so that I can intercept calls and do impersonation. I'm getting an error when I try this though... the error message is: 'this' type cannot be an interface i...

Datacontact for Castle.Proxies.EntityProxy failed

How to send Castle.Proxies.EntityProxy via WCF Channel? How to set the proxy as KnownType? ...

Is it possible to add a property to a type, via a DynamicProxy?

I'm using Castle DynamicProxy to create a proxy of a given type at runtime - including a couple mixins. I'm trying to figure out if it's possible to also add arbitrary properties to the proxy, e.g.: class BaseType { string Foo { get; set; } } and at runtime, I create a new type, that would look like this: class BaseTypeProxy384848...

Proxy not getting attributes on virtual properties?

Using DynamicProxy 2.2 I think I'm seeing this issue: "Inheritable attributes on virtual properties not available on proxy" http://support.castleproject.org/projects/DYNPROXY/issues/view/DYNPROXY-ISSUE-109 I've got a base class with a virtual property. The property is marked with [XmlIgnore]. If I serialize a derived class, the prop...

How to "really" down-cast a DynamicProxy back to its original type (to send over WCF)

OK, the situation is we have a class, PatientDto, and a DynamicProxy generated by Castle, PatientDtoProxy. We're using this proxy in the Silverlight client, then want to send it back to the server via a WCF service call. The WCF service Contract expects a PatientDto (ie not the proxy) and, as expected, blows up if you try to send anyth...

Managed Extensibility Framework, Interception and Dynamic Proxy

easy task, but couldn't find any direction. i want to intercept object creation of MEF and return proxy (using castle dynamic proxy) of my object either then the object itself. is it possible to do that? ...

How can I aggregate interfaces into with castle dynamic proxy

I would like to allow for declarative mixin management in my codebase. I would like to declare an interface like public interface IMyRepo : IRepository, ICanFindPeopleByName, ICantSing {} So my classes can consume only the bits of the data access layer they need. In my IoC container I would like to aggregate the implementations of t...

How to inject a base class to a proxy using DynamicProxy?

I would like to inject a base class to any proxy class with a an attribute. For example: public class Base { } [SomeAttribute()] public class Foo { } public class Bar { } If Foo doesn't inherit from base, inject it however Bar shouldn't be injected with base. Anyone got a clue? ...

Make object dynamically implement an interface in code

I want to make this test pass - anyone got an idea how to do that? public class Something { public string Name {get; set} } public interface IWithId { public Guid Id {get; set} } public class IdExtender { public static Object Extend(object toExtend) { ...? } } public class Tests { [Test] public v...

Castle dynamic proxy and INotifyPropertyChanged on WPF

I'm wrapping my entities with a proxy using Castle DP, my entities implement by themselves INotifyPropertyChanged. and raise the event when set is called. i wrote some unit test on the wrapping to see that the propertychanged event is fired when i manipulate entities through the proxy and they all passed. the problem is on a real appli...

Is there a Windsor/DynamicProxy logging aspect, I can place as an attribute to my classes/methods?

In the castle stack? after the answer I came up with this: namespace Limpens.Windsor.LoggingAspect { using System; using Castle.Core; using Castle.Core.Interceptor; using Castle.Core.Logging; using Castle.MicroKernel; using Castle.MicroKernel.ModelBuilder; public class LoggingContributor : IContributeCompon...

Create ObservableCollection with castle dinamicproxy for a DataGrid

How can I create a observableCollection of T where T is a castle dinamicproxy that Implements INotifyPropertyChanged and wpf DataGrid can add new itens? I managed to create the collection but when the Data Grid create a new row I receive a TargetInvocationException I belive the problem is that the proxy cannot be created with a paramet...