PerWebRequest and Transient lifeStyles

走远了吗. 提交于 2019-12-25 07:20:48

问题


Can someone please help me understand several things?

  1. Do I still have to register PerRequestModule to use LifeStylePerWebRequest? I use Castle.Windsor 3.2.0.0 and it seems everything works without this module. I definetly remember that there was an exception before that tells me "You forget to register this module".
  2. What "objects tracked by release policy" really means? I use several Components with LifeStyleTransient but when I Resolve one I get it in "objects tracked by release policy" property, when I Resolve others I don't get them there.
  3. How can I check the actual objects stored inside the container (and their number)?

回答1:


1) I guess since version 3.x PerRequestModule will be automatically registered by windsor.

2) An object will be tracked by windsor only if needed(for ex if its lifestyle is Transient and it implements IDisposable interface).

3) You can run unit tests checking for handlers or manually set a debug point once you registered all components and navigate with VS viewer container object: it has a property that lists all registered components.



来源:https://stackoverflow.com/questions/18576350/perwebrequest-and-transient-lifestyles

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!