title: Serialization for memcached
body: <p>I have this huge domain object(say parent) which contains other domain objects. It takes a lot of time to "create" this parent object by querying a DB (OK we are optimizing the DB). So we decided to cache it using memcached (with <a href="http://www.northscale.com/" rel="nofollow noreferrer">northscale</a> to be specific)</p>
  
  <p>So I have gone through my code and marked all the classes (I think) as <code>[Serializable]</code>, but when I add it to the cache, I see a Serialization Exception getting thrown in my VS.net output window.</p>
  
  <pre><code>var cache = new NorthScaleClient("MyBucket");
  cache.Store(StoreMode.Set, key, value);
  </code></pre>
  
  <p>This is the exception:</p>
  
  <pre><code>A first chance exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll
  </code></pre>
  
  <p>SO my guess is, I have not marked all classes as <code>[Serializable]</code>. I am not using any third party libraries and can mark any class as <code>[Serializable]</code>, but how do I find out which class is failing when the cache is trying to serialize the object ?</p>
  
  <p>Edit1: casperOne comments make me think. I was able to cache these domain object with Microsoft Cache Application Block without marking them <code>[Serializable]</code>, but not with NorthScale memcached. It makes me think that there might be something to do with their implementation, but just out of curiosity, am still interested in finding where it fails when trying to add the object to memcached</p>