Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在将 ASP.NET 应用程序迁移到 .NET5 并遇到以下使用 StructureMap 的代码...
For<ICache>().AlwaysUnique().Singleton().HttpContextScoped().Add<RedisCache>()
我们在新应用程序中使用 Lamar;替换的等效代码是.AlwaysUnique().Singleton().HttpContextScoped()什么?
.AlwaysUnique().Singleton().HttpContextScoped()
在与 Jeremy Miller(Lamar 的作者)进行了一些交流后,他确认最后一个获胜,在这种情况下,它将是 HttpContextScoped(或 Lamar 中的 Scoped)。