Exemple #1
0
        private static void SetDetachedQueryParameters(IDetachedQuery detachedQuery, params INHParameter[] parameters)
        {
            detachedQuery.ShouldNotBeNull("detachedQuery");

            if (parameters == null || parameters.Length == 0)
            {
                return;
            }

            foreach (var parameter in parameters)
            {
                if (parameter.Type == null)
                {
                    detachedQuery.SetParameter(parameter.Name, parameter.Value);
                }
                else
                {
                    detachedQuery.SetParameter(parameter.Name, parameter.Value, parameter.Type);
                }

                if (IsDebugEnabled)
                {
                    log.Debug("쿼리에 Parameter를 설정합니다... Name=[{0}], Value=[{1}], Type=[{2}]", parameter.Name, parameter.Value,
                              parameter.Type);
                }
            }
        }
        /// <summary>
        /// Set only parameters to a given <see cref="IDetachedQuery"/>.
        /// </summary>
        /// <param name="destination">The given <see cref="IDetachedQuery"/>.</param>
        /// <remarks>
        /// The method use <see cref="IDetachedQuery"/> to set properties of <paramref name="destination"/>.
        /// Existing parameters in <paramref name="destination"/> are merged/overriden.
        /// </remarks>
        public void SetParametersTo(IDetachedQuery destination)
        {
            foreach (var obj in optionalUntypeParams)
            {
                destination.SetProperties(obj);
            }

            // Set untyped positional parameters
            foreach (var pup in posUntypeParams)
            {
                destination.SetParameter(pup.Key, pup.Value);
            }

            // Set untyped named parameters
            foreach (var nup in namedUntypeParams)
            {
                destination.SetParameter(nup.Key, nup.Value);
            }

            // Set untyped named parameters list
            foreach (var nulp in namedUntypeListParams)
            {
                destination.SetParameterList(nulp.Key, nulp.Value);
            }

            // Set typed positional parameters
            foreach (var pp in posParams)
            {
                destination.SetParameter(pp.Key, pp.Value.Value, pp.Value.Type);
            }

            // Set typed named parameters
            foreach (var np in namedParams)
            {
                destination.SetParameter(np.Key, np.Value.Value, np.Value.Type);
            }

            // Set typed named parameters List
            foreach (var nlp in namedListParams)
            {
                destination.SetParameterList(nlp.Key, (IEnumerable)nlp.Value.Value, nlp.Value.Type);
            }
        }
Exemple #3
0
        /// <summary>
        /// Set only parameters to a given <see cref="IDetachedQuery"/>.
        /// </summary>
        /// <param name="destination">The given <see cref="IDetachedQuery"/>.</param>
        /// <remarks>
        /// The method use <see cref="IDetachedQuery"/> to set properties of <paramref name="destination"/>.
        /// Existing parameters in <paramref name="destination"/> are merged/overriden.
        /// </remarks>
        public void SetParametersTo(IDetachedQuery destination)
        {
            foreach (object obj in optionalUntypeParams)
            {
                destination.SetProperties(obj);
            }

            // Set untyped positional parameters
            foreach (KeyValuePair <int, object> pup in posUntypeParams)
            {
                destination.SetParameter(pup.Key, pup.Value);
            }

            // Set untyped named parameters
            foreach (KeyValuePair <string, object> nup in namedUntypeParams)
            {
                destination.SetParameter(nup.Key, nup.Value);
            }

            // Set untyped named parameters list
            foreach (KeyValuePair <string, ICollection> nulp in namedUntypeListParams)
            {
                destination.SetParameterList(nulp.Key, nulp.Value);
            }

            // Set typed positional parameters
            foreach (KeyValuePair <int, TypedValue> pp in posParams)
            {
                destination.SetParameter(pp.Key, pp.Value.Value, pp.Value.Type);
            }

            // Set typed named parameters
            foreach (KeyValuePair <string, TypedValue> np in namedParams)
            {
                destination.SetParameter(np.Key, np.Value.Value, np.Value.Type);
            }

            // Set typed named parameters List
            foreach (KeyValuePair <string, TypedValue> nlp in namedListParams)
            {
                destination.SetParameterList(nlp.Key, (ICollection)nlp.Value.Value, nlp.Value.Type);
            }
        }
		/// <summary>
		/// Set only parameters to a given <see cref="IDetachedQuery"/>.
		/// </summary>
		/// <param name="destination">The given <see cref="IDetachedQuery"/>.</param>
		/// <remarks>
		/// The method use <see cref="IDetachedQuery"/> to set properties of <paramref name="destination"/>.
		/// Existing parameters in <paramref name="destination"/> are merged/overriden.
		/// </remarks>
		public void SetParametersTo(IDetachedQuery destination)
		{
			foreach (object obj in optionalUntypeParams)
				destination.SetProperties(obj);

			// Set untyped positional parameters
			foreach (KeyValuePair<int, object> pup in posUntypeParams)
				destination.SetParameter(pup.Key, pup.Value);

			// Set untyped named parameters
			foreach (KeyValuePair<string, object> nup in namedUntypeParams)
				destination.SetParameter(nup.Key, nup.Value);

			// Set untyped named parameters list
			foreach (KeyValuePair<string, ICollection> nulp in namedUntypeListParams)
				destination.SetParameterList(nulp.Key, nulp.Value);

			// Set typed positional parameters
			foreach (KeyValuePair<int, TypedValue> pp in posParams)
				destination.SetParameter(pp.Key, pp.Value.Value, pp.Value.Type);

			// Set typed named parameters
			foreach (KeyValuePair<string, TypedValue> np in namedParams)
				destination.SetParameter(np.Key, np.Value.Value, np.Value.Type);

			// Set typed named parameters List
			foreach (KeyValuePair<string, TypedValue> nlp in namedListParams)
				destination.SetParameterList(nlp.Key, (ICollection)nlp.Value.Value, nlp.Value.Type);
		}
		/// <summary>
		/// Set only parameters to a given <see cref="IDetachedQuery"/>.
		/// </summary>
		/// <param name="destination">The given <see cref="IDetachedQuery"/>.</param>
		/// <remarks>
		/// The method use <see cref="IDetachedQuery"/> to set properties of <paramref name="destination"/>.
		/// Existing parameters in <paramref name="destination"/> are merged/overriden.
		/// </remarks>
		public void SetParametersTo(IDetachedQuery destination)
		{
			foreach (var obj in optionalUntypeParams)
				destination.SetProperties(obj);

			// Set untyped positional parameters
			foreach (var pup in posUntypeParams)
				destination.SetParameter(pup.Key, pup.Value);

			// Set untyped named parameters
			foreach (var nup in namedUntypeParams)
				destination.SetParameter(nup.Key, nup.Value);

			// Set untyped named parameters list
			foreach (var nulp in namedUntypeListParams)
				destination.SetParameterList(nulp.Key, nulp.Value);

			// Set typed positional parameters
			foreach (var pp in posParams)
				destination.SetParameter(pp.Key, pp.Value.Value, pp.Value.Type);

			// Set typed named parameters
			foreach (var np in namedParams)
				destination.SetParameter(np.Key, np.Value.Value, np.Value.Type);

			// Set typed named parameters List
			foreach (var nlp in namedListParams)
				destination.SetParameterList(nlp.Key, (IEnumerable) nlp.Value.Value, nlp.Value.Type);
		}