Exemple #1
0
        public object ToObject(DbValue item, IMember member)
        {
            // Parse strings to allow graceful migration to integers

            if (item.Kind == DbValueType.S)
            {
                return(Enum.Parse(member.Type, item.ToString()));
            }

            return(Enum.ToObject(member.Type, item.ToInt()));
        }
Exemple #2
0
        public override IPAddress Parse(DbValue item)
        {
            switch (item.Kind)
            {
            case DbValueType.S: return(IPAddress.Parse(item.ToString()));

            case DbValueType.B: return(new IPAddress(item.ToBinary()));

            default: throw new ConversionException($"Cannot DB type: {item.Kind} to IPAddress");
            }
        }
Exemple #3
0
 public override Version Parse(DbValue item) => Version.Parse(item.ToString());
Exemple #4
0
 public override Uri Parse(DbValue item) => new Uri(item.ToString());
Exemple #5
0
        public object ToObject(DbValue item, IMember member)
        {
            var text = item.ToString();

            return(JsonArray.Parse(text));
        }
Exemple #6
0
 public object ToObject(DbValue item, IMember member) =>
 JsonObject.Parse(item.ToString());
Exemple #7
0
 public object ToObject(DbValue item, IMember member)
 {
     return(item.ToString());
 }