Lazy<T> 怎么了?Autofac 支持吗? [英] What happened to Lazy<T> support in Autofac?

查看:37
本文介绍了Lazy<T> 怎么了?Autofac 支持吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Autofac 2.1 的 beta 版本中,支持自动解析 Lazy,如 Nicholas Blumhardt 的 使用 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.

代码似乎仍然在谷歌代码的源代码中,但我在我看过的任何 .NET 4.0 二进制文件中都找不到 LazyDependencyModule.是不是搬到别的地方去了?

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 分辨率?

How do I use Autofac's automatic Lazy<T> resolution with the latest Autofac builds?

推荐答案

您无需在生产 Autofac 2 版本中自己注册 LazyDependencyModule.它是默认容器的一部分,因此只需注册 TLazy 将被提供.

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&lt;T&gt; 怎么了?Autofac 支持吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆