예제 #1
0
        public static Int32Key FindInt32KeyWithoutType(this KeyToParametersConverter converter, IReadOnlyKeyValueCollection parameters, string keyType)
        {
            Ensure.NotNull(converter, "converter");
            Int32Key key;

            if (converter.TryGetWithoutType(parameters, keyType, out key))
            {
                return(key);
            }

            return(Int32Key.Empty(keyType));
        }
예제 #2
0
        /// <summary>
        /// Gets a key from the <paramref name="parameters"/> with <paramref name="prefix"/> and <see cref="IKey.Type"/> set to <paramref name="keyType"/> or throws <see cref="MissingKeyInParametersException"/>.
        /// </summary>
        /// <param name="converter">A key-parameters converter.</param>
        /// <param name="parameters">A collection of parameters.</param>
        /// <param name="prefix">A values prefix for <paramref name="parameters"/>.</param>
        /// <param name="keyType">A <see cref="IKey.Type"/> for key to create.</param>
        /// <returns>A key from the <paramref name="parameters"/> or throws <see cref="MissingKeyInParametersException"/>.</returns>
        public static IKey GetWithoutType(this KeyToParametersConverter converter, IReadOnlyKeyValueCollection parameters, string keyType, string prefix)
        {
            Ensure.NotNull(converter, "converter");
            IKey key;

            if (converter.TryGetWithoutType(parameters, keyType, prefix, out key))
            {
                return(key);
            }

            throw new MissingKeyInParametersException();
        }