.net - 转换为 Lamar - 注册 - 使用 StructureMap 的这段代码的等价物是什么?
问题描述
我正在将 ASP.NET 应用程序迁移到 .NET5 并遇到以下使用 StructureMap 的代码...
For<ICache>().AlwaysUnique().Singleton().HttpContextScoped().Add<RedisCache>()
我们在新应用程序中使用 Lamar;替换的等效代码是.AlwaysUnique().Singleton().HttpContextScoped()
什么?
解决方案
在与 Jeremy Miller(Lamar 的作者)进行了一些交流后,他确认最后一个获胜,在这种情况下,它将是 HttpContextScoped(或 Lamar 中的 Scoped)。
推荐阅读
- r - 我正在更新和修改现有的 Shiny 代码以适合我的项目,但它会在 if: 参数长度为零时创建错误
- python-3.x - WX:主窗口失去焦点事件
- python - 我如何比较python代码中序列中的奇数?
- ruby-on-rails - 截断文本而不截断 HTML before_save 回调
- php - Centos7 上的 PHP-FPM 与 Directadmin -> 通过 httpd-alias 的 url 未解析为 php
- python - 从 Python 向外部应用程序提供多个输入
- date - Lua:获取季度数和季度日
- python - 检查嵌套列表是否有重复项
- c - gdb dir 命令和源路径 -- 什么是 $cdir、$cwd?
- python - 如何使用 PYTHON 将选择性图像文件从一个文件夹复制到另一个文件夹