public override ValueNode CreateSerializerOverride(ValueNode parent) { if(ChildType.IsPrimitive) return new PrimitiveListValueNode(parent, Name, this); return new ListValueNode(parent, Name, this); }
public ValueValueNode(ValueNode parent, string name, TypeNode typeNode) : base(parent, name, typeNode) { }
public override ValueNode CreateSerializerOverride(ValueNode parent) { return new ValueValueNode(parent, Name, this); }
protected PrimitiveCollectionValueNode(ValueNode parent, string name, TypeNode typeNode) : base(parent, name, typeNode) { }
public PrimitveArrayValueNode(ValueNode parent, string name, TypeNode typeNode) : base(parent, name, typeNode) { }
public ValueNode CreateSerializer(ValueNode parent) { try { return CreateSerializerOverride(parent); } catch (Exception e) { var reference = Name == null ? String.Format("type '{0}'", Type) : String.Format("member '{0}'", Name); var message = String.Format("Error serializing {0}. See inner exception for detail.", reference); throw new InvalidOperationException(message, e); } }
public abstract ValueNode CreateSerializerOverride(ValueNode parent);
public PrimitiveListValueNode(ValueNode parent, string name, TypeNode typeNode) : base(parent, name, typeNode) { }
protected CollectionValueNodeBase(ValueNode parent, string name, TypeNode typeNode) : base(parent, name, typeNode) { }
public object GetValue(ValueNode target) { if (IsConst) return _constValue; var source = GetSource(target); return ValueConverter == null ? source.Value : Convert(source.Value, target.CreateSerializationContext()); }
public ValueNode GetSource(ValueNode target) { var relativeSource = (ValueNode) GetRelativeSource(target); return relativeSource.GetChild(Path); }
public void Bind(ValueNode target, Func<object> callback) { if (IsConst) return; var source = GetSource(target); Func<object> finalCallback = ValueConverter == null ? callback : () => ConvertBack(callback(), target.CreateSerializationContext()); source.TargetBindings.Add(finalCallback); }