Serialize objects for use with memcache

Serialize objects for use with memcache

Postby alfmos » Mon 29 Aug 2011 17:23

Hi,
I want use memcache in a site. to use it I need to serialize objects.
I serialized domain objects, but I have this error now:

Enyim.Caching.MemcachedClient - System.Runtime.Serialization.SerializationException: The type 'Devart.Data.Linq.a' in assembly 'Devart.Data.Linq, Version=2.50.29.0, Culture=neutral, PublicKeyToken=09af7300eec23701' is not marked as serializable.

With this object I can't serialize my objects.
How can I make internal types of devart serializable?

thanks to all
alfmos
 
Posts: 6
Joined: Wed 26 Aug 2009 11:12

Postby StanislavK » Wed 31 Aug 2011 15:27

According to the stack trace, Enyim.Caching.MemcachedClient uses BinaryFormatter to serialize objects. LinqConnect entities are not designed to be serialized via BinaryFormatter, DataContractSerializer should be used instead. For more information about this way of serialization, please refer to the following article:
http://msdn.microsoft.com/en-us/library/bb546184.aspx#Y1680
(it is writted about LINQ to SQL, but can be applied to LinqConnect as well).
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48


Return to dotConnect for MySQL