Asp.net 5 injection interception call method

I am working with the new DIP (Injection Dependency) asp.net 5 https://github.com/aspnet/DependencyInjection . So far, I have done well.

But now it's time to do more complicated things. As I did in the past with Windsor Castle or Unity. I need to make a proxy for the class, intercept calls and register it.

AOP (Aspect Oriented Program)

In Windsor Castle, it's called: DinamicProxy In asp.net 5, how can I do the same?

Example:

public interface ITracingInterceptorHelper
{
    void BeforeCall(string typeName, string methodName, Dictionary<string, object> parameters);
    void ErrorOnCall(string typeName, string methodName, Exception e);
    void AfterCall(string typeName, string methodName, object returnValue);
}


public class TracingInterceptor : BaseInterceptor, IInterceptor
    {
        private readonly ITracingInterceptorHelper _helper;

        public TracingInterceptor(ITracingInterceptorHelper tracingInterceptorHelper)
        {
            _helper = tracingInterceptorHelper;
        }


        public void Intercept(IInvocation invocation)
        {
        //...
        }
    }

Thanks. Relations

+4
source share
1 answer

In asp.net 5, how can I do the same?

. ASP.NET 5. , SOLID AOP.

"" , , , .

+3

Source: https://habr.com/ru/post/1616619/


All Articles