public override TStronglyTypedId ReadJson(JsonReader reader, Type objectType, TStronglyTypedId existingValue, bool hasExistingValue, JsonSerializer serializer)
        {
            if (reader.TokenType is JsonToken.Null)
            {
                return(null);
            }

            var value   = serializer.Deserialize <TValue>(reader);
            var factory = StronglyTypedIdHelper.GetFactory <TValue>(objectType);

            return((TStronglyTypedId)factory(value));
        }
        public override object ConvertFrom(ITypeDescriptorContext?context, CultureInfo?culture, object value)
        {
            if (value is string s)
            {
                value = IdValueConverter.ConvertFrom(s);
            }

            if (value is TValue idValue)
            {
                var factory = StronglyTypedIdHelper.GetFactory <TValue>(_type);
                return(factory(idValue));
            }

            return(base.ConvertFrom(context, culture, value));
        }