/// <summary>
        /// Converts the object to the query parameter value.
        /// </summary>
        /// <param name="processingContext">The <see cref="QueryficationProcessingContext"/> which holds information about the current value.</param>
        /// <returns>The <see cref="string"/> used in the query.</returns>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="processingContext"/>' cannot be null. </exception>
        public String Process(QueryficationProcessingContext processingContext)
        {
            if (processingContext == null)
            {
                throw new ArgumentNullException(nameof(processingContext));
            }

            return(this.typeConverter.ConvertToString(processingContext.SourceValue));
        }
Example #2
0
        /// <summary>
        /// Converts the object to the query parameter value.
        /// </summary>
        /// <param name="processingContext">The <see cref="QueryficationProcessingContext"/> which holds information about the current value.</param>
        /// <returns>The <see cref="string"/> used in the query.</returns>
        /// <exception cref="ArgumentNullException">The value of 'processingContext' cannot be null. </exception>
        public String Process(QueryficationProcessingContext processingContext)
        {
            if (processingContext == null)
            {
                throw new ArgumentNullException(nameof(processingContext));
            }

            return(processingContext.SourceValue.ToString());
        }
        /// <summary>
        /// Converts the object to the query parameter value.
        /// </summary>
        /// <param name="processingContext">The <see cref="QueryficationProcessingContext"/> which holds information about the current value.</param>
        /// <returns>The <see cref="string"/> used in the query.</returns>
        /// <exception cref="ArgumentNullException">The value of 'processingContext' cannot be null. </exception>
        public virtual String Process(QueryficationProcessingContext processingContext)
        {
            if (processingContext == null)
            {
                throw new ArgumentNullException(nameof(processingContext));
            }

            var enumerable = ((IEnumerable)processingContext.SourceValue).Cast <Object>().Select(oldValue => this.itemValueProcessor.Process(processingContext.CreateProcessingContext(oldValue)));

            return(String.Join(processingContext.Configuration.QueryParameterValueToValueSeparatorChar.ToString(), enumerable));
        }
        /// <summary>
        /// Converts the object to the query parameter value.
        /// </summary>
        /// <param name="processingContext">The <see cref="QueryficationProcessingContext"/> which holds information about the current value.</param>
        /// <returns>The <see cref="String"/> used in the query.</returns>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="processingContext"/>' cannot be null. </exception>
        public String Process(QueryficationProcessingContext processingContext)
        {
            if (processingContext == null)
            {
                throw new ArgumentNullException(nameof(processingContext));
            }

            var underlyingType = processingContext.SourceValue.GetType().GetEnumUnderlyingType();

            return(Convert.ChangeType(processingContext.SourceValue, underlyingType).ToString());
        }
Example #5
0
        /// <summary>
        /// Converts the object to the query parameter value.
        /// </summary>
        /// <param name="processingContext">The <see cref="QueryficationProcessingContext"/> which holds information about the current value.</param>
        /// <returns>The <see cref="string"/> used in the query.</returns>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="processingContext"/>' cannot be null. </exception>
        public String Process(QueryficationProcessingContext processingContext)
        {
            if (processingContext == null)
            {
                throw new ArgumentNullException(nameof(processingContext));
            }

            var cultureInfo = (CultureInfo)processingContext.SourceValue;

            return(cultureInfo.TwoLetterISOLanguageName);
        }
Example #6
0
        /// <summary>
        /// Converts the object to the query parameter value.
        /// </summary>
        /// <param name="processingContext">The <see cref="QueryficationProcessingContext"/> which holds information about the current value.</param>
        /// <returns>The <see cref="String"/> used in the query.</returns>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="processingContext"/>' cannot be null. </exception>
        public String Process(QueryficationProcessingContext processingContext)
        {
            if (processingContext == null)
            {
                throw new ArgumentNullException(nameof(processingContext));
            }

            var sourceDateTime = (DateTime)processingContext.SourceValue;

            return(sourceDateTime.ToUnixTimestamp().ToString());
        }
Example #7
0
        /// <summary>
        /// Converts the object to the query parameter value.
        /// </summary>
        /// <param name="processingContext">The <see cref="QueryficationProcessingContext"/> which holds information about the current value.</param>
        /// <returns>The <see cref="String"/> used in the query.</returns>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="processingContext"/>' cannot be null. </exception>
        public String Process(QueryficationProcessingContext processingContext)
        {
            if (processingContext == null)
            {
                throw new ArgumentNullException(nameof(processingContext));
            }

            dynamic dynamicLazy = processingContext.SourceValue;

            return(this.innerValueProcessor.Process(dynamicLazy.Value));
        }
        /// <summary>
        /// Converts the object to the query parameter value.
        /// </summary>
        /// <param name="processingContext">The <see cref="QueryficationProcessingContext"/> which holds information about the current value.</param>
        /// <returns>The <see cref="String"/> used in the query.</returns>
        /// <exception cref="InvalidOperationException">The <see cref="EnumValueNameAttribute"/>-Attribute was not found on the supplied Enum value</exception>
        /// <exception cref="ArgumentNullException">The value of 'processingContext' cannot be null. </exception>
        public String Process(QueryficationProcessingContext processingContext)
        {
            if (processingContext == null)
            {
                throw new ArgumentNullException(nameof(processingContext));
            }

            var enumMembers             = processingContext.SourceValue.GetType().GetMember(processingContext.SourceValue.ToString());
            var methodTypeNameAttribute = enumMembers[0].GetAttribute <EnumValueNameAttribute>();

            if (methodTypeNameAttribute == null)
            {
                throw new InvalidOperationException(String.Format(ExceptionMessages.EnumValueNameAttributeNotFoundExceptionMessage, processingContext.SourceValue, processingContext.SourceValue.GetType().Name));
            }

            return(methodTypeNameAttribute.ParameterValue);
        }
Example #9
0
 /// <summary>
 /// Converts the object to the query parameter value.
 /// Always returns <c>null</c>.
 /// </summary>
 /// <param name="processingContext">The <see cref="QueryficationProcessingContext"/> which holds information about the current value.</param>
 /// <returns>The <see cref="string"/> used in the query.</returns>
 public String Process([CanBeNull] QueryficationProcessingContext processingContext)
 {
     return(null);
 }