Geo*_*uer 6 api castle-windsor fluent-interface
当使用城堡windsor自动注册时,我看到人们在做类似的事情
_container.Register(
AllTypes.Pick().FromAssembly(Assembly.GetExecutingAssembly())
.WithService.FirstInterface());
Run Code Online (Sandbox Code Playgroud)
对于我的生活,我无法弄清楚Pick()方法的作用,也无法找到任何文档.有谁可以向我解释一下?
Pick(IEnumerable<Type>) 是它的同义词 From(IEnumerable<Type>),即它选择指定的类型作为注册目标.
AllTypes.Pick() 是一样的 AllTypes.Of<object>(),所以它有效地选择所有类型.
AllTypes.Pick().FromAssembly(Assembly.GetExecutingAssembly()) 将在执行程序集中选择所有类型(当然可以过滤)
像往常一样,请查看流畅的API wiki和/或测试用例以获取更多信息.
| 归档时间: |
|
| 查看次数: |
2116 次 |
| 最近记录: |