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

How to implement the override methods of Equals and GetHashCode in a class that implements IProxyGenerationHook in Castle.Core?

Reading the Castle.Core documentation, in this link, they recommend that always overriding the Equals and GetHashCode methods of the classes that implement IProxyGenerationHook. I have a class called MiHook that implements such interface, but this…
Marlonchosky
  • 494
  • 5
  • 16
2
votes
1 answer

Is it possible to create dynamic proxies without having base class or interface?

Is it possible to create a dynamic proxy using common libraries like Castle Dynamic Proxy without having any base class or interface? I'm indeed interested to have dynamic on-the-fly classes in run-time.
Afshar Mohebi
  • 10,479
  • 17
  • 82
  • 126
2
votes
0 answers

automapper proxy base type

how can I set BaseTypeForInterfaceProxy on Automapper.
hazimdikenli
  • 5,709
  • 8
  • 37
  • 67
2
votes
2 answers

Using DynamicProxy as a decorator pattern in windsor container

I am looking for some info on using and configuring windsor to provide a dynamic proxy to intercept calls to an instance of another class. My class represents a resource that should be retained as a long lived instance by the container for…
2
votes
1 answer

Async Interception using Castle dynamic proxy

I'm trying to build a dynamic http client using dynamic proxy to intercept the calls and create an http request with it. The issue i had was with Async methods: private Task PostAsync(HttpClient client, string url, HttpRequestParameters…
Erez.L
  • 77
  • 1
  • 10
2
votes
1 answer

Intercept controllers

I am trying to create Audit logs for every controller so that I can keep track of invoked Actions. I am using .net core and Castle Core Dynamic Proxy. class AuditInterceptor : IInterceptor { private readonly IAuditingHelper _auditingHelper; …
DarthVader
  • 52,984
  • 76
  • 209
  • 300
2
votes
3 answers

Autofac method level interception with Castle DynamicProxy in .NET Core 2

I currently wrote an Interceptor which code is below public class TransactionalInterceptor : IInterceptor { public void Intercept(IInvocation invocation) { using (var transaction = ...) { try { …
mspasiuk
  • 602
  • 1
  • 7
  • 23
2
votes
1 answer

Web API - Interceptor - intercepting async controller actions

In our Web API integration tests we are having issues with testing the async actions. In my simple test I created a simple controller action: [HttpGet] [Route("test")] public async Task Test() { return await Task.FromResult(new…
2
votes
0 answers

How to handle protected generic overloads in a Castle DynamicProxy?

I'm encountering a problem creating a Castle DynamicProxy for a generic object with an overloaded method signature. I originally ran into the problem via Moq, but I was able to reproduce the same Exception by generating a fairly simple proxy…
Origameg
  • 324
  • 2
  • 9
2
votes
1 answer

Interface proxy without inheriting attributes

When creating an interface proxy using Castle DynamicProxy, it seems that the created proxy object always “inherits” the attributes of the interface. In general, this is not a real problem, but in my case, I’m using the proxy to generate a WCF…
poke
  • 369,085
  • 72
  • 557
  • 602
2
votes
0 answers

Castle Windsor Interceptor selectors and hooks

I'm doing some project in Castle Windsor and I have some problems with interceptor hook in config file I created class that impements IProxyGenerationHook: public class LoggingProxyGenerationHook : IProxyGenerationHook { #region…
nikolavas
  • 63
  • 1
  • 2
  • 7
2
votes
2 answers

Castle DynamicProxy generated class names

Does anybody know if it is possible to control the names of the types generated through Castle DynamicProxy? I was hoping to take advantage of the ability to persist the assembly generated by Castle to add some additional classes with some specific…
yonkz
  • 23
  • 2
  • 7
2
votes
1 answer

Castle DynamicProxy Interface Proxy Generation

I have a WindsorContainer. I have a ILazyComponentLoader (if it matters) and an Interface (ISomething) with an Interceptor attribute on in. [Interceptor(typeof(DynamicImplementationInterceptor)] public interface ISomething I want Windsor to use…
Jeff
  • 35,755
  • 15
  • 108
  • 220
2
votes
1 answer

Can a Castle DynamicProxy-generated proxy be forced to implement members as explicit interface implementations?

For example, let's say I've defined an interface as follows: public interface IWhatever { string Text { get; set; } } And I implement it in a mixin: public class WhateverMixin : IWhatever { string IWhatever.Text { get; set; } } When I…
Matías Fidemraizer
  • 63,804
  • 18
  • 124
  • 206
2
votes
1 answer

Adding an Interceptor to existing Castle.DynamicProxy proxy

Let's say I have a Castle.DynamicProxy object that is created by a third party. In this case Rhino.Mocks. var rhinoObj = MockRepository.GenerateMock(); For one reason or another I want to be able to use this generated object by Rhino and…
MartinM
  • 1,736
  • 5
  • 20
  • 33