79727637

Date: 2025-08-06 17:28:26
Score: 0.5
Natty:
Report link

as long as DtoService.GetDtos() it is being used,using var context = new dtoContext(...) itcontext gets properly disposed of even though you're creating DtoService without DI. It's short-lived and doesn't hold resources, so there's no memory leak risk and no need to manually dispose of anything. MyService since you're not holding the EF context there, your provider pattern with DataService is a good way to avoid cluttering DI with multiple DB context services make sure you don’t accidentally hold onto instances of DtoService or the context longer than needed

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Single line (0.5):
  • Low reputation (1):
Posted by: Dr Chamyoung