private void WriteAObject(object writer, object receiver, string modelName, WriteSettings settings, JsonTextWriter jsonWriter) { ObjectInfo info = ObjectInfo.Create(receiver, modelName); if (info.IsObjectContext) { TkDebug.ThrowIfNoGlobalVariable(); BaseGlobalVariable.Current.ObjectContext.Push(receiver); } jsonWriter.WriteStartObject(); foreach (var attr in info.Attributes) { SerializerUtil.WritePropertyInfo(this, writer, receiver, settings, attr, null); } if (info.Content != null) { SerializerUtil.WritePropertyInfo(this, writer, receiver, settings, info.Content, null); } else { SerializerUtil.WriteElements(this, info, writer, receiver, settings); } jsonWriter.WriteEndObject(); jsonWriter.Flush(); if (info.IsObjectContext) { BaseGlobalVariable.Current.ObjectContext.Pop(); } }
public static void Write(IObjectSerializer serializer, object writer, object receiver, string modelName, WriteSettings settings) { ObjectInfo info = ObjectInfo.Create(receiver, modelName); if (info.IsObjectContext) { TkDebug.ThrowIfNoGlobalVariable(); BaseGlobalVariable.Current.ObjectContext.Push(receiver); } foreach (var attr in info.Attributes) { SerializerUtil.WritePropertyInfo(serializer, writer, receiver, settings, attr, null); } if (info.Content != null) { SerializerUtil.WritePropertyInfo(serializer, writer, receiver, settings, info.Content, null); } else { SerializerUtil.WriteElements(serializer, info, writer, receiver, settings); } if (info.IsObjectContext) { BaseGlobalVariable.Current.ObjectContext.Pop(); } }
private void WriteAObject(object writer, object receiver, string modelName, WriteSettings settings) { ObjectInfo info = ObjectInfo.Create(receiver, modelName); foreach (var attr in info.Attributes) { SerializerUtil.WritePropertyInfo(this, writer, receiver, settings, attr, null); } SerializerUtil.WriteElements(this, info, writer, receiver, settings); }