public void WriteObject(object writer, object receiver, string modelName, WriteSettings settings, QName root, object serializerData) { ObjectInfo info = ObjectInfo.Create(receiver, modelName); if (info.IsObjectContext) { TkDebug.ThrowIfNoGlobalVariable(); BaseGlobalVariable.Current.ObjectContext.Push(receiver); } var elements = info.Elements.CreateOrderPropertyInfoList(); var writeElements = from item in elements where item.IsSingle && IsSupport(item.Content.Attribute) select item; foreach (var item in writeElements) { ObjectPropertyInfo property = item.Content; object value = property.GetValue(receiver); if (value == null) { continue; } item.Content.Attribute.WriteObject(this, writer, value, settings, item.Content, serializerData); } if (info.IsObjectContext) { BaseGlobalVariable.Current.ObjectContext.Pop(); } }
public static void WritePropertyInfo(IObjectSerializer serializer, object writer, object receiver, WriteSettings settings, ObjectPropertyInfo attr, object serializerData) { object value = attr.GetValue(receiver); if (value != null) { attr.Attribute.WriteObject(serializer, writer, value, settings, attr, serializerData); } }
internal static object GetPropertyValue(object receiver, Type objectType, ObjectPropertyInfo info) { object value = info.GetValue(receiver); // ObjectUtil.GetValue(info, receiver); if (value == null) { Type type = objectType ?? info.DataType; value = ObjectUtil.CreateObject(type); info.SetValue(receiver, value); } return(value); }
public object GetValue(object receiver) { return(fObjectInfo.GetValue(receiver)); }