/// <summary> /// Deserializes the specified model. /// </summary> /// <param name="model">The model.</param> /// <param name="serializationContext">The serialization context.</param> public virtual void Deserialize(ModelBase model, TSerializationContext serializationContext) { Argument.IsNotNull("model", model); Argument.IsNotNull("context", serializationContext); using (var finalContext = GetContext(model, serializationContext, SerializationContextMode.Deserialization)) { bool?previousLeanAndMeanValue = null; if (!ModelBase.GlobalLeanAndMeanModel) { previousLeanAndMeanValue = model.LeanAndMeanModel; model.LeanAndMeanModel = true; } var serializerModifiers = SerializationManager.GetSerializerModifiers(finalContext.ModelType); Log.Debug("Using '{0}' serializer modifiers to deserialize type '{1}'", serializerModifiers.Length, finalContext.ModelType.GetSafeFullName()); var serializingEventArgs = new SerializationEventArgs(finalContext); Deserializing.SafeInvoke(this, serializingEventArgs); foreach (var serializerModifier in serializerModifiers) { serializerModifier.OnDeserializing(finalContext, model); } BeforeDeserialization(finalContext); DeserializeMembers(finalContext); AfterDeserialization(finalContext); foreach (var serializerModifier in serializerModifiers) { serializerModifier.OnDeserialized(finalContext, model); } Deserialized.SafeInvoke(this, serializingEventArgs); model.FinishDeserialization(); if (previousLeanAndMeanValue.HasValue) { model.LeanAndMeanModel = previousLeanAndMeanValue.Value; } } }