Exemplo n.º 1
0
        /// <summary>
        /// Вывод элементов в строку с указанным разделителем
        /// </summary>
        /// <param name="glue">Разделитель для соединения элементов</param>
        /// <returns></returns>
        public string ToString(string glue = ", ")
        {
            if (this.IsEmpty())
            {
                return(string.Empty);
            }

            ListJoin keyValuePairs = new ListJoin();

            foreach (string key in this.Keys)
            {
                keyValuePairs.AddFormat("{0}={1}", key, this[key]);
            }
            return(keyValuePairs.ToString(glue));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets a flatted list of all conditions associated with this query
        /// </summary>
        /// <returns></returns>
        internal virtual List <Condition> GetConditions()
        {
            var listConditions = new List <Condition>();

            if (WhereCondition != null)
            {
                listConditions.AddRange(WhereCondition.GetAllConditions());
            }

            /// All Conditions from Join
            listConditions.AddRange(ListJoin.Select(r => r.Condition.GetAllConditions()).SelectMany(r => r));

            /// All Conditions from joined Queries
            listConditions.AddRange(ListJoin.Select(r => r.Query.GetConditions()).SelectMany(r => r));

            /// All Conditions from FromQuery
            if (FromQuery != null)
            {
                listConditions.AddRange(FromQuery.Item1.GetConditions());
            }

            return(listConditions);
        }