QueryBuilder/Compilers/Compiler.cs
/// <summary>
/// Wrap a single string in a column identifier.
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
Wrap a single string in a column identifier.
Wrap a single string in a column identifier .
public virtual string Wrap(string value)
        {
            if (value.ToLower().Contains(" as "))
            {
                var index = value.ToLower().IndexOf(" as ");
                var before = value.Substring(0, index);
                var after = value.Substring(index + 4);
                return Wrap(before) + " AS " + WrapValue(after);
            }
            if (value.Contains("."))
            {
                return string.Join(".", value.Split('.').Select((x, index) =>
                {
                    return WrapValue(x);
                }));
            }
            return WrapValue(value);
        }
public virtual string Wrap ( string value ) { if ( value . ToLower ( ) . Contains ( " " ) ) { var index = value . ToLower ( ) . IndexOf ( " " ) ; var before = value . Substring ( 0 , index ) ; var after = value . Substring ( index + 4 ) ; return Wrap ( before ) + " " + WrapValue ( after ) ; } if ( value . Contains ( " " ) ) { return string . Join ( " " , value . Split ( ' ' ) . Select ( ( x , index ) => { return WrapValue ( x ) ; } ) ) ; } return WrapValue ( value ) ; }
Wrap a single string in a column identifier.
Wrap a single string in a column identifier .
// If we reach here then the value does not contain an "AS" alias // nor dot "." expression, so wrap it as regular value.
None
value
string
None