NS Memcached + Enyim does not work with ASP.net DataRow
Discovered this in our prod server, and after a few tests, verified this indeed causes an issue.
Here is the exception from Enyim (v2.3) client, we are using NS Memcached v1.0.3
[INDENT]
System.Runtime.Serialization.SerializationException: Type 'System.Data.DataRow' in Assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable. at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) at Enyim.Caching.Memcached.DefaultTranscoder.Enyim.Caching.Memcached.ITranscoder.Serialize(Object value) in d:\EnyimMemcached\Enyim.Caching\Memcached\Transcoders\DefaultTranscoder.cs:line 101 at Enyim.Caching.MemcachedClient.PerformStore(StoreMode mode, String key, Object value, UInt32 expires, UInt64& cas) in d:\EnyimMemcached\Enyim.Caching\MemcachedClient.cs:line 290[/INDENT]
Actually the situation is the reverse: "DataRow does not work with memcached"
Memcached is a byte[] store, in order to store anything insde it, it must be convertible to a series of bytes. The primitive types are handled by the client, while complex types are serialized using the standard serialization methods of .NET. (that's why you need to mark your custom classes as serializable)
One thing you could try is to add your rows to a DataTable whihc in fact is serializable and will handle the row serialization for you.
Thanks, this is actually an error we didn't expect, since datatable works, but strange why MS labelled datarow as a non-serializable data type.
We've changed all of our datarows to Dictionary, and it is now fine.
Thanks guys!
Thanks for this, I will look into it.
Seems like the error is being caused because the System.Data.DataRow is not marked as serializable. Do you know if this is something you can change or needs to be handled elsewhere?
Thanks.
Perry
Forum support is great for free but sometimes you need a guaranteed response time and dedicated resources for your questions or issues.
Consider purchasing enterprise-level support from Membase: http://www.membase.com/products-and-services/overview
Call or email "sales -at- membase -dot- com" today!