예제 #1
0
        /// <summary>
        /// Parsers a command capturing its original parameters if the receiving collection
        /// is not null.
        /// </summary>
        public virtual string OnParseCommand(ICommand obj, IParameterCollection pc, bool nulls)
        {
            var str = obj.GetCommandText(iterable: false);

            if (str == null)
            {
                return(string.Empty);
            }

            if (obj.Parameters != null && obj.Parameters.Count != 0)
            {
                if (pc != null)                 // Capturing the original parameters...
                {
                    foreach (var par in obj.Parameters)
                    {
                        var item = pc.AddCreate(par.Value);
                        str = str.Replace(par.Name, item.Name);
                    }
                }
                else                 // Border case: no receiving collection...
                {
                    foreach (var par in obj.Parameters)
                    {
                        var value = Engine.TryTransform(par.Value);
                        str = str.Replace(par.Name, Parse(value, null, nulls));
                    }
                }
            }

            return(str);
        }
예제 #2
0
        /// <summary>
        /// Parsers a value or constant, capturing it into a parameter if such collection is
        /// available.
        /// </summary>
        protected virtual string OnParseConstant(object obj, IParameterCollection pc)
        {
            if (obj == null)
            {
                return(OnParseNull());
            }

            if (pc != null)
            {
                return(pc.AddCreate(obj).Name);
            }
            else
            {
                return(obj.ToString());
            }
        }
예제 #3
0
		/// <summary>
		/// Parsers a value or constant, capturing it into a parameter if such collection is
		/// available.
		/// </summary>
		protected virtual string OnParseConstant(object obj, IParameterCollection pc)
		{
			if (obj == null) return OnParseNull();

			if (pc != null) return pc.AddCreate(obj).Name;
			else return obj.ToString();
		}
예제 #4
0
		/// <summary>
		/// Parsers a command capturing its original parameters if the receiving collection
		/// is not null.
		/// </summary>
		public virtual string OnParseCommand(ICommand obj, IParameterCollection pc, bool nulls)
		{
			var str = obj.GetCommandText(iterable: false);
			if (str == null) return string.Empty;

			if (obj.Parameters != null && obj.Parameters.Count != 0)
			{
				if (pc != null) // Capturing the original parameters...
				{
					foreach (var par in obj.Parameters)
					{
						var item = pc.AddCreate(par.Value);
						str = str.Replace(par.Name, item.Name);
					}
				}
				else // Border case: no receiving collection...
				{
					foreach (var par in obj.Parameters)
					{
						var value = Engine.TryTransform(par.Value);
						str = str.Replace(par.Name, Parse(value, null, nulls));
					}
				}
			}

			return str;
		}