在文档中指出,您应该始终将拦截器设置为瞬态。如果我有这个示例代码;
//register interceptor
container.Register(Classes.FromAssemblyNamed("Sample.Interceptors")
.BasedOn<Castle.DynamicProxy.IInterceptor>()
.LifestyleTransient());
//Configure components to intercept
container.Register(Classes.FromAssemblyNamed("Sample.Component")
.IncludeNonPublicTypes().InNamespace("Sample.Component", true)
.Configure(c=>
c.Interceptors(InterceptorReference.ForType<SampleInterceptor>())
.Anywhere.LifestyleSingleton())
.WithService.DefaultInterfaces()
);
我需要担心释放SampleInterceptor
吗?还是一旦Sample.Component
中的服务被容器释放,它就会自动释放?