示例#1
0
 public override ValueNode CreateSerializerOverride(ValueNode parent)
 {
     if(ChildType.IsPrimitive)
         return new PrimitiveListValueNode(parent, Name, this);
     return new ListValueNode(parent, Name, this);
 }
示例#2
0
 public ValueValueNode(ValueNode parent, string name, TypeNode typeNode)
     : base(parent, name, typeNode)
 {
 }
 public override ValueNode CreateSerializerOverride(ValueNode parent)
 {
     return new ValueValueNode(parent, Name, this);
 }
示例#4
0
 protected PrimitiveCollectionValueNode(ValueNode parent, string name, TypeNode typeNode)
     : base(parent, name, typeNode)
 {
 }
 public PrimitveArrayValueNode(ValueNode parent, string name, TypeNode typeNode) : base(parent, name, typeNode)
 {
 }
示例#6
0
 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);
     }
 }
示例#7
0
 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)
 {
 }
示例#10
0
        public object GetValue(ValueNode target)
        {
            if (IsConst)
                return _constValue;

            var source = GetSource(target);

            return ValueConverter == null ? source.Value : Convert(source.Value, target.CreateSerializationContext());
        }
示例#11
0
 public ValueNode GetSource(ValueNode target)
 {
     var relativeSource = (ValueNode) GetRelativeSource(target);
     return relativeSource.GetChild(Path);
 }
示例#12
0
        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);
        }