/// <summary> /// Deserializes the specified model. /// </summary> /// <param name="model">The model.</param> /// <param name="context">The serialization context.</param> protected virtual object Deserialize(object model, ISerializationContext <TSerializationContextInfo> context) { Argument.IsNotNull("model", model); Argument.IsNotNull("context", context); var serializerModifiers = SerializationManager.GetSerializerModifiers(context.ModelType); Log.Debug("Using '{0}' serializer modifiers to deserialize type '{1}'", serializerModifiers.Length, context.ModelTypeName); var serializingEventArgs = new SerializationEventArgs(context); Deserializing?.Invoke(this, serializingEventArgs); foreach (var serializerModifier in serializerModifiers) { serializerModifier.OnDeserializing(context, model); } BeforeDeserialization(context); var deserializedMemberValues = DeserializeMembers(context); PopulateModel(context, deserializedMemberValues); // Always use the deserialized model (might be a value type) model = context.Model; AfterDeserialization(context); foreach (var serializerModifier in serializerModifiers) { serializerModifier.OnDeserialized(context, model); } Deserialized?.Invoke(this, serializingEventArgs); return(model); }
private void OnDeserializing(SerializeEventArgs e) { Deserializing?.Invoke(this, e); }
protected virtual void OnDeserializing(SerializeEventArgs e) { Deserializing?.Invoke(this, e); OnModified(EventArgs.Empty); }
/// <summary> /// Triggers the Deserializing event. /// </summary> /// <param name="ea">The event arguments.</param> public virtual void OnDeserializing(SerializingEventArgs ea) { Deserializing?.Invoke(this, ea); }