Intercept async method that returns generic Task<> via DynamicProxy

后端 未结 5 1391
一生所求
一生所求 2020-12-05 13:11

My questions is related to this post Intercept the call to an async method using DynamicProxy

I want to implement interceptor that works with async methods that retu

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-05 13:47

    Having a need to intercept methods returning Task, I've created an extension to Castle.Core that simplifies the process.

    Castle.Core.AsyncInterceptor

    The package is available to download on NuGet.

    The solution is largely based on the answer from @silas-reinagel, but simplifies it by providing a new interface to implement IAsyncInterceptor. There are also further abstractions to that make interception similar to implementing Interceptor.

    See the readme of the project for further details.

提交回复
热议问题