Serializing Classes For Windows Azure Cache

I have had much trouble retrieving objects from cache that are decorated with Entity classes.

The exception i receive when reading the object from cache starts with:

System.Runtime.Serialization.SerializationException:¬†Assembly ‘EntityFrameworkDynamicProxies …¬†PublicKeyToken=null’ is not found.

To fix this, what I have done is create a class that duplicates the members of the Entity class, copy construct it thereby creating a new object, and adding that new object to cache.

When i retrieve the item, i populate the original Entity class and send it back to the caller. This seems to work well.





March 2012

March 2012