public void Process(IWriteOnlyValueDescriptor <object> descriptor) { string type; if (_store.TryGet("Type", out type)) { descriptor.Route(new MyCustomStateMember((IReflectionStateMember)descriptor.StateMember, Type.GetType(type)), descriptor.Owner, true); } }
public void ProcessGeneric <T>(IWriteOnlyValueDescriptor <T> descriptor) { XElement temp = _reader; _reader = _reader.Element(descriptor.StateMember.Name); CreateObject(descriptor); descriptor.Climb(); _reader = temp; }
private void CreateObject <T>(IWriteOnlyValueDescriptor <T> descriptor) { XAttribute attribute = _reader.Attribute("Type"); if (attribute != null) { var type = attribute.Value; Type instanceType = Type.GetType(type); T field = (T)Activator.CreateInstance(instanceType); descriptor.Set(field); } }
public void Process <T>(IWriteOnlyValueDescriptor <T> descriptor) { string type; if (_store.TryGet("Type", out type)) { var value = (T)Activator.CreateInstance(Type.GetType(type)); descriptor.Set(value); var temp = _store; _store = _store.GetInner(descriptor.StateMember.Name); descriptor.Climb(); _store = temp; } }
public void ProcessNull <TField>(IWriteOnlyValueDescriptor <TField> descriptor) { _writer.Write(ReadWriteHeader.Null); }
public void ProcessNull <TField>(IWriteOnlyValueDescriptor <TField> descriptor) { // Don't climb }
public void ProcessForWrite(IWriteOnlyValueDescriptor <IAsyncResult> descriptor) { // Sets all fields that are assignable from IAsyncResult to null. // (i.e: all fields that have static type object or IAsyncResult) descriptor.Set((IAsyncResult)null); }
public void ProcessNull <TField>(IWriteOnlyValueDescriptor <TField> descriptor) { WritePropertyName(descriptor); _writer.WriteValue("null"); EndWritePropertyName(); }
public void ProcessNull <TField>(IWriteOnlyValueDescriptor <TField> descriptor) { // Does nothing. }