Serenity.Data.SqlUpdate.RemoveT0Reference C# (CSharp) Method

RemoveT0Reference() public static method

public static RemoveT0Reference ( string expression ) : string
expression string
return string
        public static string RemoveT0Reference(string expression)
        {
            var index = expression.IndexOf("T0.", StringComparison.OrdinalIgnoreCase);
            if (index == 0)
            {
                string rest = expression.Substring(3);
                if (SqlSyntax.IsValidQuotedIdentifier(rest))
                    return rest;
            }

            if (index >= 0)
                return T0ReferenceRemover.RemoveT0Aliases(expression);

            return expression;
        }

Usage Example

Beispiel #1
0
        /// <summary>
        ///   Adds a new condition to the WHERE part of the query with an "AND" between.</summary>
        /// <param name="condition">
        ///   Condition.</param>
        /// <returns>
        ///   SqlDelete object itself.</returns>
        public SqlDelete Where(string condition)
        {
            if (condition == null || condition.Length == 0)
            {
                throw new ArgumentNullException("condition");
            }

            condition = SqlUpdate.RemoveT0Reference(condition);

            if (_where.Length > 0)
            {
                _where.Append(SqlKeywords.And);
            }

            _where.Append(condition);

            return(this);
        }