携带组件与线程生活方式

时间:2022-10-11 20:11:56

I have some per-thread components in my Windsor container. I'm also using PLINQ. In the specific case of PLINQ operations, I actually want some of these components carried over to the new thread.

我在温莎容器中有一些线程组件。我也使用PLINQ。在PLINQ操作的特定情况下,我实际上希望将其中的一些组件传递给新的线程。

Does anyone have a suggestion for how to intelligently implement such a behavior for Windsor?

对于如何明智地为温莎实施这种行为,有人有什么建议吗?

Thanks.

谢谢。

1 个解决方案

#1


1  

PerThread evidently won't work in this case, since PLINQ is multi-threaded and so the container will produce new instances. You might want to try ContextualLifestyle or something like it.

显然,在这种情况下PerThread不能工作,因为PLINQ是多线程的,因此容器将生成新的实例。你可能想尝试情景生活方式或者类似的东西。

#1


1  

PerThread evidently won't work in this case, since PLINQ is multi-threaded and so the container will produce new instances. You might want to try ContextualLifestyle or something like it.

显然,在这种情况下PerThread不能工作,因为PLINQ是多线程的,因此容器将生成新的实例。你可能想尝试情景生活方式或者类似的东西。