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.

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s