Wanna use StructureMap to store HttpContext/User based explicit instances
Posted
by René
on Stack Overflow
See other posts from Stack Overflow
or by René
Published on 2010-04-26T15:14:40Z
Indexed on
2010/04/27
15:23 UTC
Read the original article
Hit count: 248
c#
|structuremap
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?
© Stack Overflow or respective owner