Lazy<T> 怎么了?Autofac 支持吗?

编程入门 行业动态 更新时间:2024-10-11 21:21:16
本文介绍了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.它是默认容器的一部分,因此只需注册 T 和 Lazy 将被提供.

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 支持吗?

本文发布于:2023-11-13 22:59:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1585556.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:amp   Lazy   lt   Autofac   gt

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!