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"); } }
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()); } }
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()); } }
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()); } }
public override Guid Parse(DbValue item) => new Guid(item.ToBinary());
public override Uid Parse(DbValue item) => Uid.Deserialize(item.ToBinary());
public object ToObject(DbValue item, IMember member) => item.ToBinary();