Reputation: 17799
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.
Upvotes: 4
Views: 902
Reputation: 29811
The syntax in 2.6 is:
c.For<ISomeObject>().LifecycleIs(new HttpSessionLifecycle()).Use<SomeObject>();
Upvotes: 4
Reputation: 8849
I believe this will do the trick:
For<ISomeObject>()
.HttpContextScoped()
.Use<SomeObject>();
Upvotes: -1