I have an issue with casting the cached objects from Microsoft Velocity caching beteween different versions of a given type.
This shows up, for example, when the Velocity cache is accessed from two components:
- a website from one build of the code base
- a Windows service from a later build of a later revision of the code base
The website puts an object of type Customer in the cache, and the Windows service reads the same object from the cache, and then tries to cast to the type Customer' in the later build of a later revision of the code base.
This yields a castin开发者_如何学编程g error, like the one described here: http://social.msdn.microsoft.com/Forums/en/velocity/thread/f264c5b1-8cfe-49f3-8b86-711810f88140
How can I avoid this casting error with Microsoft Velocity?
Is it possible to avoid? Or do I have to be defensive: catch the casting exception, clear the object from the cache, read a new instance, and save that to the cache?
Just for the sake of completion this thread was closed at msdn (http://social.msdn.microsoft.com/Forums/en/velocity/thread/f264c5b1-8cfe-49f3-8b86-711810f88140)
The problem was with entities being placed under App_Code folder for that was triggering recompile every time the code was changed i.e. rather than a pre-compiled library as such.
精彩评论