I'm having difficulty figuring out how to have StructureMap cache a non-default instance. I can cache the default instance with code like this
ForRequestedType<ISession>()
.CacheBy(InstanceScope.HttpContext)
.TheDefault.Is.ConstructedBy(() => ObjectFactory.GetInstance<ISessionFactory>().OpenSession());
which works as expected. And I can create a named instance fine
InstanceOf<User>().Is.ConstructedBy(() => someAwesomeConstructor()).WithName("CurrentUser");
But I'd really like to cache "CurrentUser" by session, but .CacheBy() only exists in CreatePluginFamilyExpression<> and the only way I can tell to get from CreatePluginFamilyExpression<> to IsExpression<> is by the property TheDefault, which forces me to create a default, which I don't want.