Questions tagged [castle-dynamicproxy]

Castle DynamicProxy is a library for generating lightweight .NET proxies on the fly at runtime. Proxy objects allow calls to members of an object to be intercepted without modifying the code of the class.

Castle DynamicProxy is a library for generating lightweight .NET proxies on the fly at runtime. Proxy objects allow calls to members of an object to be intercepted without modifying the code of the class.

Resources

335 questions
5
votes
1 answer

NuGet: NHibernate, Castle.Core 3.0 and where is ProxyFactoryFactory?

I installed with NuGet the packages NHibernate and Castle.Core 3.0 for a new project. Usually we copied around the dlls manually; it is the first time I do that with NuGet. Now I can't find out how to configure the ProxyFactoryFactory, or let's say,…
sl3dg3
  • 5,026
  • 12
  • 50
  • 74
5
votes
2 answers

Why does getting the mocked instance created with Moq throw a System.BadImageFormatException?

This question may be related to another question and it certainly results with a System.BadImageFormatException. Maybe it's the same thing but exposed differently? I have the following the code: public interface IFoo where T : class, new() { T…
Jonathon Watney
  • 20,248
  • 9
  • 38
  • 40
5
votes
2 answers

Replace a class at the assembly level so all references call a new implementation

I would like to replace a class at the assembly level so all references call a new implementation. Lets say I have common class used in assemblies throughout my project such as System.Generic.Collections.List My project references other assemblies…
johnny 5
  • 19,893
  • 50
  • 121
  • 195
5
votes
1 answer

DynamicProxy Generation Speed

I'm trying to troubleshoot some startup time concerns. After doing some profiling, I've found the main culprit is ClassProxyGenerator.GenerateCode. This takes 400-600ms per type the first time. So if the entry point to the application has 8…
Jeff
  • 35,755
  • 15
  • 108
  • 220
5
votes
1 answer

Performance advice for using Castle DynamicProxy in .NET web-apps

I am starting out with Castle DynamicProxy and I have this sample to track changes to properties of an object. Questions: Should I cache (in a static field) the ProxyGenerator() instance I use in AsTrackable()? I going to use in an ASP.NET…
Raghu Dodda
  • 1,505
  • 1
  • 21
  • 28
5
votes
2 answers

Add an extra interface using Castle Dynamic Proxy 2?

I would like to create a dynamic proxy to an existing type, but add an implementation of a new interface, that isn't already declared on the target type. I can't figure out how to achieve this. Any ideas?
James L
  • 16,456
  • 10
  • 53
  • 70
5
votes
2 answers

Autofac: Tips for increasing performance when using DynamicProxy?

I just start using DynamicProxy2 today. And found it caused significant performance drop. See the code below. Test1 is 10 times slower than Test2. Any tips for increasing performance when using DynamicProxy? class Program { public void Main() …
user593358
5
votes
1 answer

Return exception from proxy

I'm using the heavily-undocumented Castle dynamic-proxy system. I've managed to make it do almost everything I want, except for one thing: How do you make a proxied method throw an exception instead of returning a value? public sealed class…
MathematicalOrchid
  • 61,854
  • 19
  • 123
  • 220
5
votes
2 answers

Castle Windsor Interceptor not working with Method-Level attribute

I have a Castle Interceptor that I'm trying to apply via attributes. It's working great when I apply my Interceptor attribute at class-level, but it's not working at all when I'm applying at method-level. What am I doing wrong? I don't want to…
Andy
  • 2,709
  • 5
  • 37
  • 64
5
votes
2 answers

castle dynamic proxy creation

I am implementing a design where my layer would sit between client and server, and whatever objects i get from server, i would wrap it in a transparent proxy and give to the client, that way i can keep a track of what changed in the object, so when…
np-hard
  • 5,725
  • 6
  • 52
  • 76
5
votes
1 answer

Castle DynamicProxy Interceptor having problems with different assemblies

I have a scenario like this: I'm using interceptor to catch calls to a class that is inside assembly (let's call it Feature) that is referenced by main project. Assembly Feature is installed by NuGet (it's not public but our internal one) and has…
Dawid Kowalski
  • 1,197
  • 1
  • 9
  • 23
5
votes
1 answer

Interception with Ninject. Fails to load IProxyRequestFactory

I'm learning to use Ninject and Interceptor pattern. I have the following interceptor. public class MyInterceptor:IInterceptor { public void Intercept(IInvocation invocation) { Console.WriteLine("Pre Execute: " +…
5
votes
2 answers

Create a dynamic proxy for an abstract class with an internal constructor

I'd like to create dynamic proxy for a type in the BCL that is an abstract class with an internal constructor. I've been castle's dynamic proxy and this fails with an exception stating there is no parameterless constructor (their is - it's…
Robert
  • 6,407
  • 2
  • 34
  • 41
4
votes
1 answer

Autofac + Castle DynamicProxy: Order of interceptors

I'm using Castle DynamicProxy with Autofac. I have an object for which I've created a proxy, and I have two interceptors that act on the proxy, one for logging an exception and the second for for altering the return value of the method. The…
4
votes
2 answers

ASP.NET MVC3 controller AOP proxy not intercepting all methods, only IController.Execute

I have a project with several layers - among them the web front end (ASP.NET MVC3) and the service back end (mainly business logic). The project is a few months old, so everything is working as expected. Now I am trying to add a logging aspect to…
Joel Purra
  • 24,294
  • 8
  • 60
  • 60
1 2
3
22 23