Which Structuremap Lifecycle is best practice? (v2.5.4)

structuremap

Solution

Using the configuration helpers is probably the best practice.

    For<IMyInterface>().HybridHttpOrThreadLocalScoped().Use<MyImplementation>()

Problem

which of the following syntax is considered best practice? ``` For<IMyInterface>().LifecycleIs(new HybridLifecycle()).Use<MyImplementation>(); For<IMyInterface>().LifecycleIs(Lifecycles.GetLifecycle(InstanceScope.Hybrid)).Use<MyImplementation>(); ``` if the first one is correct, can I create one object HybridLifecycle, and use it for multiple For<...> statements, or is it necessary for each For<> to create a new HybridLifecycle?

Original source