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
3
votes
2 answers

.NET Core default dependency injection with Castle DynamicProxy

I have many AOP libraries that use Castle DynamicProxy with Autofac DI container for logging, auditing, transaction control, etc. I wonder if there is a way to declare interceptors using the default .NET Core DI container. It will be good to have…
3
votes
2 answers

Registering/Using Castle.Core.AsyncInterceptor Interceptors

I'm trying to use the Castle.Core.AsyncInterceptor package to handle exceptions thrown from async methods but I'm struggling to understand how to link it all together. My previous ExceptionInterceptor implemented the standard IInterceptor interface,…
Richard
  • 1,731
  • 2
  • 23
  • 54
3
votes
2 answers

Castle Windsor proxies, implicit interfaces and WPF Binding

I am attempting to implement a WPF ViewModel using Castle Windsor Dynamic Proxies. The idea is that I want to supply an interface (IPerson below should suffice as an example), a concrete backing class, and an interceptor (for providing automatic…
Chris Shain
  • 50,833
  • 6
  • 93
  • 125
3
votes
0 answers

C# MissingMethodException with DispatchProxy and FakeItEasy

I'm writing a class library with .NET Core and I'm using interception (DispatchProxy) for handling cross-cutting concerns. Now I have the problem that when unit testing the decorated object I get the following Exception: Exception thrown:…
Josh
  • 287
  • 1
  • 8
3
votes
0 answers

Configure StructureMap to find implementations for proxy classes

I wonder if it's possible to configure StructureMap to handle proxy class instances as the underlying instance. My problem is that the CMS I'm using (called Episerver) creates proxy instances of the classes I define, for example MyBlock will be…
OriginalUtter
  • 619
  • 3
  • 15
  • 28
3
votes
4 answers

Could not load type Castle.Proxies.IReadinessProxy when running xUnit integration tests in parallel with Autofac

I am having an issue that I've been many days unable to resolve. I use xUnit with a given-then-when abstraction to make tests more readable. I am using a wrapper over EventStore and running some integration tests. They all go well.. except one that…
diegosasw
  • 13,734
  • 16
  • 95
  • 159
3
votes
1 answer

In Castle.DynamicProxy is it possible to change a mixin value after initialisation?

I noticed that DynamicProxy objects can implement an IChangeProxyTarget interface, which allows you to do something like ((IChangeProxyTarget)myProxyObj).ChangeInvocationTarget(newTarget). Is there a way to similarly change the mixin implementation…
fostandy
  • 4,282
  • 4
  • 37
  • 41
3
votes
1 answer

How to use an Interceptor that has parameter in its constructor for Autofac InterceptorSelector

How can I use an interceptor in IInterceptorSelector.SelectInterceptors method which has a constructor parameter. I want to let Autofac resolve my interceptor with it's parameters something like in this Castle…
Yusuf Uzun
  • 1,491
  • 1
  • 13
  • 32
3
votes
1 answer

Ninject: Possible to use injection constructor when type is being proxied for AoP?

I'm doing a project ground up using Ninject 2 and one question bugs me: If you are to intercept methods on your type, you need to wrap it into proxy (castle dynamic proxy to be specific). Unless said type has a parameterless constructor, proxy…
Cortlendt
  • 2,190
  • 4
  • 29
  • 50
3
votes
0 answers

How to get unproxied object in EF CORE

With each EF version there was a different way to get an underlying object for a proxy. None of the old tricks work using EF core 2.2. I referenced Castle.Core which EF uses and called ProxyUtil.GetUnproxiedInstance but that just returns the proxy…
user1029883
  • 695
  • 7
  • 21
3
votes
0 answers

Wrap an exception in an Interceptor with async invocation target

Is it possible to write a Castle DynamicProxy Interceptor (for use with an IoC framework) that will allow you to wrap an exception being thrown by the class being intercepted? I have a class which is throwing a SqlException, and I want to have that…
Pervez Choudhury
  • 2,892
  • 3
  • 27
  • 28
3
votes
1 answer

Autofac.Extras.DynamicProxy got error with public interface

I have public interface and internal impl, public interface IService { ... } internal class Service: IService { ... } I registered them via builder.RegisterAssemblyTypes(assembly) .EnableInterfaceInterceptors() …
Horosho
  • 647
  • 1
  • 8
  • 22
3
votes
1 answer

Castle Windsor Interceptor w/o Interface?

Using Castle Windsor for DI, I've two classes that implement the same interface; and besides that have some methods and properties of their own. I'm using Castle DynamicProxy and created an Interceptor that'll do some logging w/Log4Net via the…
KBoek
  • 5,794
  • 5
  • 32
  • 49
3
votes
1 answer

How to intercept only base class methods with Castle.DynamicProxy

I have 2 classes, one for accessing the database and child class with caching. I can change the source code of both classes but there are many classes with different structure so I'm looking for a way to make generic solution that will help me to…
Vadim Martynov
  • 8,602
  • 5
  • 31
  • 43
3
votes
0 answers

Castle Windsor ProxyGenerationException

I'm getting the following error trying to proxy an Interface (without target) that implements two different generic forms of the same generic interface. So, I have: public interface IGenericFoo { void DoSomething(); } // this is the…
Jeff
  • 35,755
  • 15
  • 108
  • 220