1
저는 AutoFac에 대해서만 잘 알고 있습니다. 아래에서 자세히 설명하는 기능이 가능했는지 묻는 질문에 '정확하지 않은 것 같습니다. 이것이 가능할 용기를 아십니까?등록을 제거 할 수있는 .NET IOC 컨테이너
[TestFixture]
public class SomeCunningTests
{
class SomeType { }
[Test]
public void TestRegistrationScope()
{
var container = new IocContainerOfSomeKind();
using (new RegistrationScope(container, new SomeType()))
{
Assert.IsTrue(container.IsRegistered(typeof(SomeType)));
}
Assert.IsFalse(container.IsRegistered(typeof(SomeType)));
}
public class RegistrationScope<T> : IDisposable
{
public RegistrationScope(IocContainerOfSomeKind container, T instance)
{
//code here for registering instance
}
public void Dispose()
{
//unregister instance somehow
}
}
}