Our team has chosen Couchbase as the cache for our application. What we store in this cache are objects look like this
public class CatalogEntity
{
public int Id { get; set; }
public string Name { get; set; }
// this property gives us trouble
public Hashtable Attributes { get; set;}
}
In our code, after retrieve an object from the CouchBase cache, I found that properties of primary types(Id
and Name
) are properly deserialized, but the Attributes
of Hashtable
type is not deserialized and stay as JSON. For example, if I have something like
var entity = new CatalogEntity();
entity.Attributes["foo"] = new Foo();
The object from cache will have Attributes["foo"]
property as JSON representation of the Foo
class.
I am wondering how to have the Hashtable
type properly serialize/deserialized? Should I serialize the object to binary and instead store binary stream in the CouchBase?