インターフェイスを取得しましたIUnitOfWork
(その実装はお見せしません):
public interface IUnitOfWork : IDisposable
{
...
}
IDisposable
継承に注意してください。また、適切な実装でサービスを取得しました。
public interface IBusinessLogicService
{
...
}
public sealed class BusinessLogicService : IBusinessLogicService
{
// Dependency is auto-injected by ninject
// because of the custom injection heuristic.
public IUnitOfWork UnitOfWork { get; set; }
...
}
ninject バインディングに進みます。
kernel.Bind<IUnitOfWork>().To<UnitOfWork>().InRequestScope();
kernel.Bind<IBusinessLogicService>().To<BusinessLogicService>();
ご覧のとおり、ninject はIUnitOfWork
リクエストの最後にインスタンスを自動的に非アクティブ化し、破棄します。
さて、問題
は、ninject は、非アクティブ化オブジェクトに依存するインスタンス ( など)も非アクティブ化(および次の Web 要求で再アクティブ化) するのでしょうか?IBusinessLogicService