Backward compatiblility issues with StructureMap 2.6.1
We have been using version 2.5.3 for a while and now we are trying to upgrade to 2.6.1 and have some compatibility issues.
The previous version had StoragePolicy-Classes such as
ThreadLocalStoragePolicy
andHttpContextStoragePolicy
which all had a method toDisposeAndClearAll
. The new versions seems to have the classes renamed toX_StorageLifecycle
an开发者_开发技巧d theHttpContext
has a method calledReleaseAndDispose
and there's even a methodReleaseAndDisposeAllHttpScopedObjects
onObjectFactory
which I presume does the same. BUT: Where has the same functionality for theThreadLocalStorageLifecycle
gone?!We used to call
ObjectFactory.Inject("name", instance)
to add named instances for unit tests. It seems as there is no more overload for injecting a named instance?! I am usingObjectFactory.Configure(o => o.For<T>().Use(instance).Named("name")
now but that doesn't feel like being the easiest way. What am I missing here?
Seems that "someone" was just lazy ;-) as the functionality is still there but all the shortcuts are missing!
Call "new ThreadLocalStorageLifecycle().EjectAll()" instead.
Call the same method on the ObjectFactory.Container object.
精彩评论