예제 #1
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");
            }
        }
예제 #2
0
        public object ToObject(DbValue item, IMember member)
        {
            // TODO: Use a nested map

            switch (item.Kind)
            {
            case DbValueType.B: return(StringMap.FromBytes(item.ToBinary()));

            default: return(new StringMap());
            }
        }
예제 #3
0
        public object ToObject(DbValue item, IMember member)
        {
            // Gracefully migrate from number sets to a custom binary serializer that respects order
            switch (item.Kind)
            {
            case DbValueType.NS: return(new Int32List(item.ToArray <int>()));

            case DbValueType.B: return(Int32List.FromBytes(item.ToBinary()));

            default: return(new Int32List());
            }
        }
예제 #4
0
        public object ToObject(DbValue item, IMember member)
        {
            // Gracefully migrates from StringSets and custom binary provider to a List

            switch (item.Kind)
            {
            case DbValueType.SS: return(new StringList(item.ToStringSet()));

            case DbValueType.B: return(StringList.FromBytes(item.ToBinary()));

            case DbValueType.L: return(new StringList(item.ToArray <string>()));

            default: return(new StringList());
            }
        }
예제 #5
0
 public override Guid Parse(DbValue item) => new Guid(item.ToBinary());
예제 #6
0
 public override Uid Parse(DbValue item) => Uid.Deserialize(item.ToBinary());
예제 #7
0
 public object ToObject(DbValue item, IMember member) => item.ToBinary();