Type used in a using statement must be implicitly convertible to 'System.IDisposable'
public interface ICustomerRepository:
{
List<Customer> GetAll();
Customer Get(int customerId);
void Add(Customer customer);
}
using (var repository = IoC.Get<ICustomerRepository>())
{
......
}
会报错:Type used in a using statement must be implicitly convertible to 'System.IDisposable'
将接口从IDisposable继承即可:
public interface ICustomerRepository:IDisposable
{
List<Customer> GetAll();
Customer Get(int customerId);
void Add(Customer customer);
}

浙公网安备 33010602011771号