private void SerializeListValue( ExportedVariable exported, ITypeNode type, ICollection <object?> list) { if (_requestExecutor.Schema.TryGetType( type.NamedType().Name.Value, out INamedInputType inputType)) { SerializeListValue(exported, inputType, list); } else { throw BatchExecutor_CannotSerializeVariable(exported.Name); } }
private object Serialize(ExportedVariable exported, ITypeNode type) { if (_requestExecutor.Schema.TryGetType( type.NamedType().Name.Value, out INamedInputType inputType) && _typeConverter.TryConvert( typeof(object), inputType.RuntimeType, exported.Value, out var converted)) { return(inputType.Serialize(converted)); } throw BatchExecutor_CannotSerializeVariable(exported.Name); }
private void SerializeListValue( ExportedVariable exported, ITypeNode type, ICollection <object> list) { if (_executor.Schema.TryGetType( type.NamedType().Name.Value, out INamedInputType inputType)) { SerializeListValue(exported, inputType, list); } else { throw SerializationError(); } }
private object Serialize(ExportedVariable exported, ITypeNode type) { if (_executor.Schema.TryGetType( type.NamedType().Name.Value, out INamedInputType inputType) && _typeConversion.TryConvert( typeof(object), inputType.ClrType, exported.Value, out var converted)) { return(inputType.Serialize(converted)); } throw SerializationError(); }
private void SerializeListValue( ExportedVariable exported, INamedInputType inputType, ICollection <object?> list) { if (exported.Type.IsListType() && exported.Value is IEnumerable l) { foreach (var o in l) { if (_typeConverter.TryConvert( typeof(object), inputType.RuntimeType, o, out var converted)) { list.Add(inputType.Serialize(converted)); } else { throw BatchExecutor_CannotSerializeVariable(exported.Name); } } } else { if (_typeConverter.TryConvert( typeof(object), inputType.RuntimeType, exported.Value, out var converted)) { list.Add(inputType.Serialize(converted)); } else { throw BatchExecutor_CannotSerializeVariable(exported.Name); } } }
private void SerializeListValue( ExportedVariable exported, INamedInputType inputType, ICollection <object> list) { if (exported.Type.IsListType() && exported.Value is IEnumerable l) { foreach (var o in l) { if (_typeConversion.TryConvert( typeof(object), inputType.ClrType, o, out var converted)) { list.Add(inputType.Serialize(converted)); } else { throw SerializationError(); } } } else { if (_typeConversion.TryConvert( typeof(object), inputType.ClrType, exported.Value, out var converted)) { list.Add(inputType.Serialize(converted)); } else { throw SerializationError(); } } }