How to set session scope for plugin in StructureMap 2.6?

c#, session, session-scope, structuremap

Solution

The syntax in 2.6 is:

c.For<ISomeObject>().LifecycleIs(new HttpSessionLifecycle()).Use<SomeObject>();

Problem

How to set session scope for plugin in StructureMap 2.6? In previous versions it is done this way: ``` For<ISomeObject>().CacheBy(StructureMap.InstanceScope.HttpSession).Use<SomeObject>(); ``` However, Visual Studio displays a warning telling that the `CacheBy` method is deprecated, and that `LifecycleIs` method can be used instead.

Original source