MicroLite.Builder.SelectSqlBuilder.Where C# (CSharp) Method

Where() public method

public Where ( string column ) : IWhereSingleColumn
column string
return IWhereSingleColumn
        public IWhereSingleColumn Where(string column)
        {
            if (string.IsNullOrEmpty(column))
            {
                throw new ArgumentException(ExceptionMessages.ArgumentNullOrEmpty.FormatWith("column"));
            }

            this.WhereColumnName = this.SqlCharacters.EscapeSql(column);

            if (!this.AddedWhere)
            {
                this.InnerSql.Append(" WHERE");
                this.AddedWhere = true;
            }

            return this;
        }

Same methods

SelectSqlBuilder::Where ( string predicate ) : IAndOrOrderBy
SelectSqlBuilder::Where ( ) : IWhereExists

Usage Example

        public void WhereThrowsArgumentExceptionForNullPredicate()
        {
            var sqlBuilder = new SelectSqlBuilder(SqlCharacters.Empty);

            var exception = Assert.Throws<ArgumentException>(
                () => sqlBuilder.Where(null, new object[0]));

            Assert.Equal(ExceptionMessages.ArgumentNullOrEmpty.FormatWith("predicate"), exception.Message);
        }
All Usage Examples Of MicroLite.Builder.SelectSqlBuilder::Where