Open mannok opened 2 years ago
Given you need to tell us whether it's interface interception or class interception when you register, and whatever we do here needs to also work with the other features in core Autofac like adapters, decorators, aggregate services, and so on, can you elaborate on your proposal to explain how you would expect it to behave in all of these various situations?
Hi @tillig , Thanks for awaring.
I would like to intercept all implementation of DI services in order to enable all-round exception logging, i.e. using interface and implementation pattern I am able to intercept all function executions by enclosing it with try-catch block.
May I know if it is possible?
@mannok it is not currently possible to register a global interceptor. This issue is about a proposal to make that work. I posed several questions about the desired functionally and those haven't been answered. There is no current ongoing work on this issue.
@tillig May I know what are those questions about? Thanks
@mannok Scroll through the issue and read all the comments.
Problem Statement
Currently, there isn't a way to intercept all registrations and we cannot make a global interceptor like "global logger". Most of the workarounds in stackoverflow are hacky and not concise https://stackoverflow.com/questions/22782086/autofac-global-interface-interceptor-with-autofac-extras-dynamicproxy2
Desired Solution
To intercept all registered interfaces in Autofac setup.