/// <summary> /// Serializes the specified model. /// </summary> /// <param name="model">The model.</param> /// <param name="context">The context.</param> protected virtual void Serialize(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); Serializing?.Invoke(this, serializingEventArgs); foreach (var serializerModifier in serializerModifiers) { serializerModifier.OnSerializing(context, model); } BeforeSerialization(context); var members = GetSerializableMembers(context, model); SerializeMembers(context, members); AfterSerialization(context); foreach (var serializerModifier in serializerModifiers) { serializerModifier.OnSerialized(context, model); } Serialized?.Invoke(this, serializingEventArgs); }
/// <summary> /// 触发序列化结束后事件 /// </summary> public void OnAfterSerialize() { Body.AtachEvent(); Serialized?.Invoke(this, EventArgs.Empty); }
protected virtual void OnSerialized(DataEventArgs <IUserSettings> e) { Serialized?.Invoke(this, e); }