开发者

Backward compatiblility issues with StructureMap 2.6.1

开发者 https://www.devze.com 2023-02-15 20:41 出处:网络
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.

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.

  1. The previous version had StoragePolicy-Classes such as ThreadLocalStoragePolicy and HttpContextStoragePolicy which all had a method to DisposeAndClearAll. The new versions seems to have the classes renamed to X_StorageLifecycle an开发者_开发技巧d the HttpContext has a method called ReleaseAndDispose and there's even a method ReleaseAndDisposeAllHttpScopedObjects on ObjectFactory which I presume does the same. BUT: Where has the same functionality for the ThreadLocalStorageLifecycle gone?!

  2. 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 using ObjectFactory.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!

  1. Call "new ThreadLocalStorageLifecycle().EjectAll()" instead.

  2. Call the same method on the ObjectFactory.Container object.

0

精彩评论

暂无评论...
验证码 换一张
取 消