0

I'm migrating an ASP.NET application to .NET5 and have come across the following code that uses StructureMap...

For<ICache>().AlwaysUnique().Singleton().HttpContextScoped().Add<RedisCache>()

We are using Lamar in the new application; what's the equivalent code to replace .AlwaysUnique().Singleton().HttpContextScoped()?

Kit
  • 20,354
  • 4
  • 60
  • 103
inthegarden
  • 267
  • 1
  • 11
  • Don't `.AlwaysUnique().Singleton()` contradict themselves? – mxmissile Jun 14 '21 at 19:53
  • 1
    @mxmissile, indeed they do, this is code I've picked up as part of a migration project and is a bit odd! Having had some comms with Jeremy Miller (Lamar author) he has confirmed that the last one wins, as you would expect. Code has now been adjusted accordingly. – inthegarden Jun 15 '21 at 13:19

1 Answers1

0

Having had some comms with Jeremy Miller (Lamar author) he has confirmed that the last one wins, in the this case it would be HttpContextScoped (or Scoped in Lamar).

inthegarden
  • 267
  • 1
  • 11