/// <summary> /// <para>Deserialize the class data from a stream.</para> /// </summary> /// <param name="reader"> /// <para>The <see cref="IPrimitiveReader"/> that extracts used to extra data from a stream.</para> /// </param> /// <param name="version"> /// <para>The value of <see cref="CurrentVersion"/> that was written to the stream when it was originally serialized to a stream; the version of the <paramref name="reader"/> data.</para> /// </param> public void Deserialize(IPrimitiveReader reader, int version) { if (version == 1) { if (reader.ReadBoolean()) { var keySpace = DataBuffer.DeserializeValue(reader); var descr = LocalCache.Policy.GetDescription(keySpace); var dependencyVersion = reader.ReadInt32(); CustomDependency = (IObjectDependency)descr.Creator(); CustomDependency.Deserialize(reader, dependencyVersion); Type = new DependencyType(); Reference = null; LastUpdatedDate = new DateTime(); } else { CustomDependency = null; Type = (DependencyType)reader.ReadInt32(); Reference = reader.Read <ObjectReference>(false); LastUpdatedDate = reader.ReadDateTime(); } } else { reader.Response = SerializationResponse.Unhandled; } }