Command services registered as singletons? #190
fbjerggaard
started this conversation in
General
Replies: 1 comment 2 replies
-
It's not required to register command services as singletons. I made it a default as I rarely (or never) use transient or scoped dependencies there, and when I do I prefer using factories to control the scope inside the service rather than outside. If you have to, there's nothing in the command service that prevents it from being registered as scoped or transient. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am working on a project where I "need" to inject some scoped services into the CommandService to access data saved earlier in the scope of the request.
That's where I spotted that the CommandService is registered as a singleton - are there any specific reasoning behind this?
I tried registering it manually as a scoped service, and so far everything seems to be working as normal - using the postgres store and mongodb projections.
Just curious as to the design choice behind this, if there has been any deeper thoughts on the matter.
Beta Was this translation helpful? Give feedback.
All reactions