-
-
Notifications
You must be signed in to change notification settings - Fork 153
Allow for UnitOfWork Scoping #25
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
Sure, just use |
Thanks for your response, and time on this issue! I was looking for a scoped lifetime on services, if possible. More than just Singleton/Factory. Example (click button and start a new unit of work processing in the background. In the scope of that unit of work the SharedService is a singleton. Once that process is done the object should be disposed and the next time the process is ran it should new up a new SharedService.) Hope that makes sense. I am coming from a C# web background and am used to scoping my Dependency Injection to the current request using StructureMap. So perhaps it is just me applying web concepts to my mobile app incorrectly ;). I of course could handle this by making SharedService always a global singleton and reset the state of it every time one of these ends but like the clean ability to scope my services without passing them around to each other. I'll close it for now since it probably doesn't make much sense in this context. Thanks! |
Hmmm, perhaps it might interest you that the next version will have a reset for Lazy Singleton so this might be a solution. |
I really like the simplicity of get_it and it's speed.
Thank you so much for creating and maintaining this product!
I am wondering if we can get the ability to do UnitOfWork scoping where even factories will be the same instance if used in the same UnitOfWork.
See the code below for the example:
Registration
Classes
Test
Can SharedService be the same instance in this unitOfWork without making it a singleton?
The text was updated successfully, but these errors were encountered: