-
-
Notifications
You must be signed in to change notification settings - Fork 153
instanceName "highly not recommended" #282
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
Comments
Hi,
Maybe the warning is a bit extreme 😁 IMHO registering the same type multiple times shouldn't be something you regularly do because there are probably better approaches than to rely on names that can't be automatically verified.
In many cases people start using the name parameters because they use get_it as their central data structure when it would be better to add your own data classes that control. The multiple instances of one type and then register that one inside get_it.
So there is no real risk involved but I don't think it's a good solution in many scenarios.
Cheers
Thomas
Am 23. Juni 2022, 10:26 +0200 schrieb David Sowerby ***@***.***>:
… Hi
Firstly, thanks for this package - I find it incredibly helpful.
I am a bit confused, though, about the use of the instanceName option. It is "highly not recommended" as in the extract below, and yet it was put forward as a possible solution in #272.
There is presumably a risk attached to using this option, but the docs do not give any indication (that I can find) what that risk might be. Could you explain the concerns?
/// [instanceName] if you provide a value here your instance gets registered with that
/// name instead of a type. This should only be necessary if you need to register more
/// than one instance of one type. It's highly not recommended.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Thanks for the very quick response. I would say that it is more than a bit extreme ! Your explanation here makes good sense, and I can see that it might be open to abuse. However, the severity of the warning may also be having a detrimental effect - in my case I created an unnecessary work around to avoid using a named instance in case it broke. But with your explanation here, I can see that my use case is valid and I did not need the work around. |
Sorry for the late response, I had to take a longer break due to health issues. After I used the instance name now in my own project, I have to agree, there are cases where it's the perfect solution. I removed the warning from the docs |
Hi
Firstly, thanks for this package - I find it incredibly helpful.
I am a bit confused, though, about the use of the
instanceName
option. It is "highly not recommended" as in the extract below, and yet it was put forward as a possible solution in #272.There is presumably a risk attached to using this option, but the docs do not give any indication (that I can find) what that risk might be. Could you explain the concerns?
The text was updated successfully, but these errors were encountered: