private void AddSubOperator(esQuerySubOperator subOperator)
        {
            if (this.SubOperators == null)
            {
                this.SubOperators = new List<esQuerySubOperator>();
            }

            this.SubOperators.Add(subOperator);
        }
        /// <summary>
        /// Aggregate StdDev.
        /// See <see cref="esQuerySubOperatorType"/> Enumeration.
        /// </summary>
        /// <example>
        /// Aggregate StdDev with the column name as the default Alias.
        /// <code>
        /// emps.Query.Select(emps.Query.Age.StdDev());
        /// </code>
        /// </example>
        /// <returns>The esAggregateItem returned to DynamicQuery.</returns>
        public esQueryItem StdDev()
        {
            esQuerySubOperator subOp = new esQuerySubOperator();
            subOp.SubOperator = esQuerySubOperatorType.StdDev;
            this.AddSubOperator(subOp);

            return this;
        }
        /// <summary>
        /// Aggregate Count.
        /// See <see cref="esQuerySubOperatorType"/> Enumeration.
        /// </summary>
        /// <example>
        /// Aggregate Count with the column name as the default Alias.
        /// <code>
        /// emps.Query.Select(emps.Query.Age.Count());
        /// </code>
        /// </example>
        /// <returns>The esAggregateItem returned to DynamicQuery.</returns>
        public esQueryItem Count()
        {
            esQuerySubOperator subOp = new esQuerySubOperator();
            subOp.SubOperator = esQuerySubOperatorType.Count;
            this.AddSubOperator(subOp);

            return this;
        }
        /// <summary>
        /// Returns a particular date part of a date column
        /// </summary>
        /// <param name="datePart"></param>
        public esQueryItem DatePart(string datePart)
        {
            esQuerySubOperator subOp = new esQuerySubOperator();
            subOp.SubOperator = esQuerySubOperatorType.DatePart;
            subOp.Parameters["DatePart"] = datePart;
            this.AddSubOperator(subOp);

            return this;
        }
        /// <summary>
        /// Aggregate Min.
        /// See <see cref="esQuerySubOperatorType"/> Enumeration.
        /// </summary>
        /// <example>
        /// Aggregate Min with the column name as the default Alias.
        /// <code>
        /// emps.Query.Select(emps.Query.Age.Min());
        /// </code>
        /// </example>
        /// <returns>The esAggregateItem returned to DynamicQuery.</returns>
        public esQueryItem Min()
        {
            esQuerySubOperator subOp = new esQuerySubOperator();
            subOp.SubOperator = esQuerySubOperatorType.Min;
            this.AddSubOperator(subOp);

            return this;
        }
        /// <summary>
        /// Returns the length of a character based column
        /// </summary>
        public esQueryItem Length()
        {
            esQuerySubOperator subOp = new esQuerySubOperator();
            subOp.SubOperator = esQuerySubOperatorType.Length;
            this.AddSubOperator(subOp);

            return this;
        }
        /// <summary>
        /// Performs a round on the column
        /// </summary>
        /// <param name="significantDigits">Round to the number of significant digits</param>
        public esQueryItem Round(int significantDigits)
        {
            esQuerySubOperator subOp = new esQuerySubOperator();
            subOp.SubOperator = esQuerySubOperatorType.Round;
            subOp.Parameters["SignificantDigits"] = significantDigits;
            this.AddSubOperator(subOp);

            return this;
        }
        /// <summary>
        /// Returns a portion of the string column
        /// </summary>
        /// <param name="length">How many characters to return</param>
        public esQueryItem Substring(int length)
        {
            esQuerySubOperator subOp = new esQuerySubOperator();
            subOp.SubOperator = esQuerySubOperatorType.SubString;
            subOp.Parameters["length"] = length;
            this.AddSubOperator(subOp);

            return this;
        }
        /// <summary>
        /// This can be used to return the first non null parameter.
        /// </summary>
        /// <remarks>
        /// The code below will return "Smith" is the LastName column in the database is null.
        /// <code>
        /// MyCollection coll = new MyCollection();
        /// coll.Query.Select(coll.Query.LastName.Coalesce("'Smith'"));
        /// coll.Query.Load();
        /// </code>
        /// </remarks>
        /// <param name="expresssions">The value to return if null</param>
        public esQueryItem Coalesce(string expresssions)
        {
            esQuerySubOperator subOp = new esQuerySubOperator();
            subOp.SubOperator = esQuerySubOperatorType.Coalesce;
            subOp.Parameters["expressions"] = expresssions;
            this.AddSubOperator(subOp);

            return this;
        }
        /// <summary>
        /// Returns a portion of the string column
        /// </summary>
        /// <param name="start">The starting character</param>
        /// <param name="length">How many characters to return</param>
        public esQueryItem Substring(System.Int64 start, System.Int64 length)
        {
            esQuerySubOperator subOp = new esQuerySubOperator();
            subOp.SubOperator = esQuerySubOperatorType.SubString;
            subOp.Parameters["start"] = start;
            subOp.Parameters["length"] = length;
            this.AddSubOperator(subOp);

            return this;
        }
        /// <summary>
        /// Performs a Right Trim (remove blanks) on the column
        /// </summary>
        public  esQueryItem RTrim()
        {
            esQuerySubOperator subOp = new esQuerySubOperator();
            subOp.SubOperator = esQuerySubOperatorType.RTrim;
            this.AddSubOperator(subOp);

            return this;
        }
        /// <summary>
        /// Returns the column in LOWER CASE
        /// </summary>
        public esQueryItem ToLower()
        {    
            esQuerySubOperator subOp = new esQuerySubOperator();
            subOp.SubOperator = esQuerySubOperatorType.ToLower;
            this.AddSubOperator(subOp);

            return this;
        }
        /// <summary>
        /// Cast informs the DataProviders that a SQL CAST operation is needed. This overloaded version
        /// of Cast is useful for Casting decimal types
        /// </summary>
        /// <remarks>
        /// In C# you can cast with the overloaded cast operators, like this: (esString)query.Age
        /// </remarks>
        /// <param name="castType">The type of cast needed</param>
        /// <returns>The very same esQueryItem now with Cast instructions</returns>
        public esQueryItem Cast(esCastType castType, int precision, int scale)
        {
            esQuerySubOperator subOp = new esQuerySubOperator();
            subOp.SubOperator = esQuerySubOperatorType.Cast;
            subOp.Parameters["esCastType"] = castType;
            subOp.Parameters["precision"] = precision;
            subOp.Parameters["scale"] = scale;
            this.AddSubOperator(subOp);

            return this;
        }
        /// <summary>
        /// Cast informs the DataProviders that a SQL CAST operation is needed. This overloaded version
        /// of Cast is useful for Casting variable length character columns
        /// </summary>
        /// <remarks>
        /// In C# you can cast with the overloaded cast operators, like this: (esString)query.Age
        /// </remarks>
        /// <param name="castType">The type of cast needed</param>
        /// <returns>The very same esQueryItem now with Cast instructions</returns>
        public esQueryItem Cast(esCastType castType, int length)
        {
            esQuerySubOperator subOp = new esQuerySubOperator();
            subOp.SubOperator = esQuerySubOperatorType.Cast;
            subOp.Parameters["esCastType"] = castType;
            subOp.Parameters["length"] = length;
            this.AddSubOperator(subOp);

            return this;
        }