Wanna use StructureMap to store HttpContext/User based explicit instances
- by René
Hi
I'm having difficulty figuring out how to store an explicitly user generated instance in StructureMap, cached by HttpContext.
When I try the code underneath, I even get the first cached instance, which leads to failures when using it for storing user credentials in Asp.Net AuthenticateRequest method.
ForRequestedType<TInterface>()
.CacheBy(InstanceScope.HttpContext)
.TheDefault.
Is.
Object(instance));
The problem is I can't create a new instance on requesting StructureMap, because I need more other factories for getting rights etc. for the current user.
Any ideas?