In a previous post (here) I showed how the contents of a
string property could be internally stored as a GZipped byte array for persistence. The code demonstrated how to achieve this, but not in a particularly pretty manner, because I did some nasty hacks inside the property’s setter and getter – i.e. I crammed all the zipping/unzipping stuff directly inside my domain class.
When using NHibernate for persistence you have another option, which I have recently learned about. So let’s rewrite the example from my previous post.