/// <summary>
        /// Adds string to any enum (and any nullable enum) converter search handler.
        /// Any enums types will be converted using <see cref="StringToEnumConverter"/>.
        /// </summary>
        /// <param name="repository">The repository to register converter to.</param>
        /// <param name="isCaseSensitive">Whether parsing should be case-sensitive.</param>
        /// <returns><paramref name="repository"/>.</returns>
        public static IConverterRepository AddEnumSearchHandler(this IConverterRepository repository, bool isCaseSensitive)
        {
            Ensure.NotNull(repository, "repository");

            if (isCaseSensitive)
            {
                return(repository.AddSearchHandler(TryConvertStringToEnumCaseSensitive));
            }
            else
            {
                return(repository.AddSearchHandler(TryConvertStringToEnum));
            }
        }
 /// <summary>
 /// Adds search handler to the <paramref name="repository"/> for converting enum types from and to <see cref="JToken"/>.
 /// </summary>
 /// <param name="repository">The repository to register handler to.</param>
 /// <param name="converterType">The way how to serialize and deserialize enum values.</param>
 /// <returns><paramref name="repository"/>.</returns>
 public static IConverterRepository AddJsonEnumSearchHandler(this IConverterRepository repository, JsonEnumConverterType converterType = JsonEnumConverterType.UseInderlayingValue)
 {
     Ensure.NotNull(repository, "repository");
     return(repository.AddSearchHandler(new TryGetJsonEnumConverter(converterType).TryFind));
 }
 /// <summary>
 /// Adds search handler for converting any type to string.
 /// </summary>
 /// <param name="repository">The repository to register converter to.</param>
 /// <returns><paramref name="repository"/>.</returns>
 public static IConverterRepository AddToStringSearchHandler(this IConverterRepository repository)
 {
     Ensure.NotNull(repository, "repository");
     return(repository.AddSearchHandler(TryConvertToString));
 }
 /// <summary>
 /// Adds search handler to the <paramref name="repository"/> for converting primitive types (<see cref="JsonPrimitiveConverter.Supported"/>) from and to <see cref="JToken"/>.
 /// </summary>
 /// <param name="repository">The repository to register handler to.</param>
 /// <returns><paramref name="repository"/>.</returns>
 public static IConverterRepository AddJsonPrimitivesSearchHandler(this IConverterRepository repository)
 {
     Ensure.NotNull(repository, "repository");
     return(repository.AddSearchHandler(TryGetJsonPrimitiveConverter));
 }