Lazy T发生了什么事?在Autofac中支持? [英] What happened to Lazy<T> support in Autofac?
问题描述
如Nicholas Blumhardt的Lazy<T>的自动解析. rel ="noreferrer"> Autofac随处可见博客文章.
In beta builds of Autofac 2.1 there was support for automatic resolution of Lazy<T>
as described in Nicholas Blumhardt's Lazing Around with Autofac blog post.
The code still seems to be in the source on Google Code, but I can't find LazyDependencyModule
in any of the .NET 4.0 binaries I've looked at. Has it moved somewhere else?
如何在最新的Autofac版本中使用Autofac的自动Lazy<T>
分辨率?
How do I use Autofac's automatic Lazy<T>
resolution with the latest Autofac builds?
推荐答案
您无需在生产的Autofac 2版本中自行注册LazyDependencyModule
.它是默认容器的一部分,因此仅提供寄存器T
和Lazy<T>
.
You don't need to register LazyDependencyModule
yourself in the production Autofac 2 builds. It is a part of the default container, so just register T
and Lazy<T>
will be provided.
确保您也不会意外使用.NET 3.5二进制文件:)
Make sure you're not accidentally using a .NET 3.5 binary, too :)
尼克
这篇关于Lazy T发生了什么事?在Autofac中支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!