How to set StructureMap 3 Lifecycle
Asked Answered
C

1

6

In StructureMap 2 I had something like this:

For<ILogger>().HybridHttpOrThreadLocalScoped().Use<Logger>();

When using Structure Map 3 should I use the following?

For<ILogger>().LifecycleIs<HybridLifecycle>().Use<Logger>();

Then I tried to apply the same change to:

For<IDispatcher>().Transient().Use<Dispatcher>();

And I wasn't able to use:

For<IDispatcher>().LifecycleIs<Transient>().Use<Dispatcher>();

Why?

Thank You, Miguel

Cryoscope answered 22/4, 2014 at 21:42 Comment(0)
U
8

First you need to install the new structuremap.web package.

PM> install-package structuremap.web

Then add these namespaces to your class

using StructureMap;
using StructureMap.Web;
using StructureMap.Web.Pipeline;

Now you have access to the HybridHttpOrThreadLocalScoped() as before.

Unguinous answered 29/4, 2014 at 12:54 Comment(2)
Where can I get documentation about structuremap 3.0 news and other things like this package thanks.Account
You can find the official StructureMap 3 documentation here.Mispronounce

© 2022 - 2024 — McMap. All rights reserved.