NHibernate serializing lazy-loaded entities with WCF
问题 I'm trying to send NH entities through the wire using WCF. I've got a complex graph of lazy-loaded objects.. I tried to implement a custom DataContractSurrogate to force initialization when serializing. Here is the code : public class HibernateDataContractSurrogate : IDataContractSurrogate { public HibernateDataContractSurrogate() { } public Type GetDataContractType(Type type) { // Serialize proxies as the base type if (typeof(INHibernateProxy).IsAssignableFrom(type)) { type = type.GetType()