public override string Serialize(RestValue value, CultureInfo cultureInfo) { var formatter = ValueFormatters.FirstOrDefault(x => x.CanSerialize(value)); if (formatter == null) { throw new RestException(RestExceptionKind.Serialization, $"Value '{value.Type}' formatter not found"); //TODO msg } return(formatter.Serialize(value, cultureInfo)); }
public string Serialize(RestValue value, CultureInfo cultureInfo) { var type = Nullable.GetUnderlyingType(value.Type); var typeValue = new RestValue(value.Value, type); var formatter = ValueFormatters.FirstOrDefault(x => x.CanSerialize(typeValue)); if (formatter == null) { throw new RestException(RestExceptionKind.Serialization, $"Value '{value.Type}' formatter not found"); //TODO msg } return(formatter.Serialize(typeValue, cultureInfo)); }