Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is the simplest way to serialize a complex object layer in .NET for caching?
    primarykey
    data
    text
    <p>Trying to introduce caching/state-persisting into the middle tier of an application with a complex object layer (and a WCF service layer, not the focus here) running under IIS. Have settled on memcached/enyim as the caching architecture, and now need to get these objects serialized efficiently (speed and space) for it.</p> <p>The object layer has a lot of pointers and interdependencies among objects, along these lines:</p> <pre><code>internal class SomeObj { private string attr1; private int attr2; private OtherObj otherObj; private List&lt;OtherOtherObj&gt; otherObjs; } internal class OtherObj { //...more attributes } internal class OtherOtherObj { // you get the idea } </code></pre> <p>Note that all fields are private. Also worth noting, most objects are internal, and many properties are either read-only (no set) or use set from a user perspective (i.e. make an object "dirty"), so cannot be used in rehydration. I have dozens of types that need caching.</p> <p>I like the looks of both protobuf-net and msgpack, but I need to get the serialization done as fast as possible, with as little alteration of the existing architecture (which works well as is) as possible, and it seems like both of these have limited support for object hierarchies. I understand DTO-type serialization well, but am new to planning the right way to serialize an object for a cache. Can one of these tools work for me? Am I stuck using built-in .NET binary in order to work with a constructor, and repopulate attributes and objects on my own terms?</p> <p>EDIT: just to clarify that last question--might make more sense if it read "Am I stuck using built-in .NET binary <em>so that I can control</em> the constructor, and repopulate attributes and objects on my own terms?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload