Updated to EntLib6 but now the Caching block breaks everything. Can I save him?

So, I updated a number of projects from Enterprise 5 to 6. Everything seemed to be fine until we tested it for the first time, and some code that accesses the caching block started throwing exceptions:

System.TypeLoadException: Could not load type 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer' from collection 'Microsoft.Practices.EnterpriseLibrary.Common, Version = 6.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35

After lots of searches, I was able to put together the following:

  • EnterpriseLibrary.Caching has been removed from Enterprise Library
  • EnterpriseLibraryContainer has also been removed for MSEL due to the way it handles dependency resolution

In short, the problem is that the Caching block is the latest version of the library and depends on what no longer exists.

Is there a way to save this other than rewriting the entire caching layer? Can I run MSEL 5.0 along with MSEL 6.0 to restore this missing object? Any other ideas?

UPDATE: The following was found in the migration guide:

If your application uses either a caching application block, a cryptography application block, or a security application block, you must provide alternative implementations of the functionality you use from these blocks. See the "Blocks Removed in Version 6" section below for more information.

So, I read it like "Well ... you're crushed." So I guess my updated question is, "Have any of you found a quick fix for this?"

+3


source to share


1 answer


So, as it turns out, the Caching block uses a factory for the CacheManager, which has been completely removed from EntLib 6. To overcome this, I had to override ICacheManager and use it instead. I changed this and did this, I was able to salvage the prod code and remove the cache block entirely.



+2


source







All Articles