How decide between scopes of repository in microservice
Hi,
I have a microservice in .net 6.0, that expose some REST API, and this service get through dependency injection a sql service to get data from database.
I can have this service replicated on more instances, (in kubernetes) so i can have multiple pods of this.So I have doubts if I should use singleton or scoped for instantiate sql repository.
I think that a singleton or scoped sql repository is irrelevant in my case, because in my service i have only one of this and if my service is replicated, another process is created, so that every pods have a one singleton sql repository inside and cannot be the same, because every process has own application space, and for security reasons cannot share memory.
Do you think my reasoning is correct?
Thanks very much!