/// <inheritdoc />
        public virtual bool?IsValue(object value, PropertyValueLevel level)
        {
            switch (level)
            {
            case PropertyValueLevel.Source:
                // the default implementation uses the old magic null & string comparisons,
                // other implementations may be more clever, and/or test the final converted object values
                return(value != null && (!(value is string stringValue) || !string.IsNullOrWhiteSpace(stringValue)));

            case PropertyValueLevel.Inter:
                return(null);

            case PropertyValueLevel.Object:
                return(null);

            default:
                throw new NotSupportedException($"Invalid level: {level}.");
            }
        }
示例#2
0
        public bool?IsValue(object value, PropertyValueLevel level)
        {
            if (value is null)
            {
                return(null);
            }

            if (value is SelectedIcon && level == PropertyValueLevel.Inter)
            {
                return(true);
            }
            if (value is HtmlString && level == PropertyValueLevel.Object)
            {
                return(true);
            }
            if (value is JObject && level == PropertyValueLevel.Source)
            {
                return(true);
            }


            return(false);
        }
示例#3
0
 public bool?IsValue(object value, PropertyValueLevel level)
 {
     return(!string.IsNullOrWhiteSpace(value?.ToString()));
 }
 public bool?IsValue(object value, PropertyValueLevel level)
 {
     return(value == null || value is string);
 }
 public bool?IsValue(object value, PropertyValueLevel level)
 => value != null && (!(value is string) || string.IsNullOrWhiteSpace((string)value) == false);
 /// <summary>
 /// Check if the raw JSON value is not an empty array
 /// </summary>
 public override bool?IsValue(object value, PropertyValueLevel level) => value?.ToString() != "[]";
 public bool?IsValue(object value, PropertyValueLevel level)
 {
     return(null);
 }
示例#8
0
 public override bool?IsValue(object value, PropertyValueLevel level) => false;
 public bool?IsValue(object value, PropertyValueLevel level)
 {
     throw new NotImplementedException();
 }
示例#10
0
 public bool?IsValue(object value, PropertyValueLevel level)
 {
     // TODO: What are we supposed to return here?
     return(null);
 }