Ejemplo n.º 1
0
        /// <summary>
        /// Converts the current WhereCondition to an SQL Query
        /// </summary>
        public static string ToQuery(WhereSeparator ws, params IWhereCondition[] conditions)
        {
            if (conditions.Length == 0)
            {
                return(string.Empty);
            }

            var sb = new StringBuilder();

            sb.Append("(");

            for (var i = 0; i < conditions.Length; i++)
            {
                sb.Append(conditions[i].ToQuery());

                if (i < conditions.Length - 1)
                {
                    sb.Append(" " + ws.ToQuery() + " ");
                }
            }

            sb.Append(")");

            return(sb.ToString());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Converts a WhereSeparator to a string
        /// </summary>
        public static string ToQuery(this WhereSeparator ws)
        {
            switch (ws)
            {
            case WhereSeparator.And:
                return("AND");

            case WhereSeparator.Or:
                return("OR");

            default:
                return(string.Empty);
            }
        }