What is the best practice for Structuremap life cycle? (V2.5.4)

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 HybridLifecycle object and use it for several For & lt ...... operators, or is it necessary for each For <> to create a new HybridLifecycle?

+5
source share
1 answer

Using configuration assistants is probably the best practice.

    For<IMyInterface>().HybridHttpOrThreadLocalScoped().Use<MyImplementation>()
+4
source

All Articles