I'm using Devart to execute DB object and Store Procedure mapping.
Now i want to store in cache (using Enyim by MemCached) a Store Procedure object result.
When i'm trying to do that i have this kind of error (in short: type Devart.Data.Linq.a in Devart.Data.Linq is not signed as serializable)
Enyim.Caching.MemcachedClient - System.Runtime.Serialization.SerializationException: Il tipo 'Devart.Data.Linq.a' nell'assembly 'Devart.Data.Linq, Version=2.50.29.0, Culture=neutral, PublicKeyToken=09af7300eec23701' non è contrassegnato come serializzabile.
in System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)
in System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)
in System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
in System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)
in System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)
in System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo)
in System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
in System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
in System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)
in Enyim.Caching.Memcached.DefaultTranscoder.SerializeObject(Object value) in d:\d\repo\EnyimMemcached\Enyim.Caching\Memcached\Transcoders\DefaultTranscoder.cs:riga 219
in Enyim.Caching.Memcached.DefaultTranscoder.Serialize(Object value) in d:\d\repo\EnyimMemcached\Enyim.Caching\Memcached\Transcoders\DefaultTranscoder.cs:riga 65
in Enyim.Caching.Memcached.DefaultTranscoder.Enyim.Caching.Memcached.ITranscoder.Serialize(Object value) in d:\d\repo\EnyimMemcached\Enyim.Caching\Memcached\Transcoders\DefaultTranscoder.cs:riga 18
in Enyim.Caching.MemcachedClient.PerformStore(StoreMode mode, String key, Object value, UInt32 expires, UInt64& cas, Int32& statusCode) in d:\d\repo\EnyimMemcached\Enyim.Caching\MemcachedClient.cs:riga 313Enyim.Caching.MemcachedClient - System.Runtime.Serialization.SerializationException: Il tipo 'Devart.Data.Linq.a' nell'assembly 'Devart.Data.Linq, Version=2.50.29.0, Culture=neutral, PublicKeyToken=09af7300eec23701' non è contrassegnato come serializzabile.
开发者_如何学Cin System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)
in System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)
in System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
in System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)
in System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)
in System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo)
in System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
in System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
in System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)
in Enyim.Caching.Memcached.DefaultTranscoder.SerializeObject(Object value) in d:\d\repo\EnyimMemcached\Enyim.Caching\Memcached\Transcoders\DefaultTranscoder.cs:riga 219
in Enyim.Caching.Memcached.DefaultTranscoder.Serialize(Object value) in d:\d\repo\EnyimMemcached\Enyim.Caching\Memcached\Transcoders\DefaultTranscoder.cs:riga 65
in Enyim.Caching.Memcached.DefaultTranscoder.Enyim.Caching.Memcached.ITranscoder.Serialize(Object value) in d:\d\repo\EnyimMemcached\Enyim.Caching\Memcached\Transcoders\DefaultTranscoder.cs:riga 18
in Enyim.Caching.MemcachedClient.PerformStore(StoreMode mode, String key, Object value, UInt32 expires, UInt64& cas, Int32& statusCode) in d:\d\repo\EnyimMemcached\Enyim.Caching\MemcachedClient.cs:riga 313
This is Enyim log. I'm surely that MemCached is right configured 'cause i've tried to get and set object in cache by telnet and this has been done.
You linq expression has not been executed and for this reason there are no serializable objects to write to the cache.
If you do a ".ToList()" on the IEnumerable you should be fine.
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).
精彩评论