-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get typeof parent in factory #117
Comments
Currently stronginject have no knowledge of why they're being resolved. I would like to provide a solution to this, but it is not a priority at the moment. In the meantime, I would suggest using Microsoft.Extensions.Logging.ILogger. Their logger takes a type parameter to mark the type it's used for, which allows easy resolution. I'm sure there is an implementation of this interface for Serilog. I know changing everything may not be practical. I will try to think of a way to intercept a resolution and inject some extra information. |
I have proposed a design at #109 (comment). Please take a look and let me know what you think! Thanks! |
CLosing as duplicate of #109 |
We use serilog for logging and it needs to be initialised with the type of the object it will be logging for (the type it is injected into)
ILogger specificLogger = logger.ForContext(typeof(Parent))
Our types have the ILogger as constructor arguments and out current injection framework creates them for us with the correct context.
I can't see anyway to achieve this with stronginject Factories
The text was updated successfully, but these errors were encountered: