beantownace
Active member
- Joined
- Feb 15, 2019
- Messages
- 42
- Programming Experience
- 5-10
Needing a little help with something I am blanking on with this. I am refactoring someones code and they have a concrete class some methods that I added into a new interface to design it better and unit test the methods needed. The concrete class has the IDisposable interface so for example:
public class CustomerHelper : IDisposable
I changed this to:
public class CustomerHelper : ICustomerHelper, IDisposable
The issue I am trying to figure out what to do with is through the code in many places there are using blocks for example.
using (var helper = new CustomerHelper) { //code in here }
Project uses Unity so now I have the following:
var helper = Services.Registry.CustomerHelper;
public static class ServicesRegistry
{
public static ICustomerHelper CustomerHelper => UnityContainerProvider.ResolveRequired<ICustomerHelper>();
}
What do I need to do to make sure the dispose is correct that is where I am struggling. Thanks for any info all.
public class CustomerHelper : IDisposable
I changed this to:
public class CustomerHelper : ICustomerHelper, IDisposable
The issue I am trying to figure out what to do with is through the code in many places there are using blocks for example.
using (var helper = new CustomerHelper) { //code in here }
Project uses Unity so now I have the following:
var helper = Services.Registry.CustomerHelper;
public static class ServicesRegistry
{
public static ICustomerHelper CustomerHelper => UnityContainerProvider.ResolveRequired<ICustomerHelper>();
}
What do I need to do to make sure the dispose is correct that is where I am struggling. Thanks for any info all.
Last edited: