How and when to dispose my objects?
问题 In my backend service I use unit of work pattern. I was wondering if I'm missing something related to disposing objects. First, this is the code I have so far, which works. The service just calls a request handler: [GlobalExceptionHandlerBehaviour(typeof(GlobalExceptionHandler))] public class CustomerService : ICustomerService { public void AddCustomer(AddCustomerRequest request) { ObjectFactory.GetInstance<AddCustomerRequestHandler>().Execute(request); } } The request handler looks like: