/// <summary> /// 获取Where条件SQL /// </summary> public string GetWhereSql() { if (string.IsNullOrWhiteSpace(WhereBuilder.ToString().Trim())) { WhereBuilder.Append(" 1=1"); } return(WhereBuilder.ToString().Trim()); }
/// <summary> /// 使用sql查询条件 /// </summary> /// <param name="sqlWhere"></param> /// <param name="param"></param> /// <returns></returns> public ICommand <T> Where(string sqlWhere, object param = null) { WhereBuilder.Append(" AND " + sqlWhere); if (param != null) { Params.AddDynamicParams(param); } return(this); }
/// <summary> /// 使用sql查询条件 /// </summary> /// <param name="sqlWhere"></param> /// <param name="param"></param> /// <returns></returns> public QuerySet <T> Where(string sqlWhere, object param = null) { WhereBuilder.Append(" AND " + sqlWhere); if (param != null) { Params.AddDynamicParams(param, true); } return(this); }
public PagedSelectCommandBuilder Or(string value) => this.Chain(() => { if (WhereBuilder.Length == 0) { throw new InvalidOperationException("There is no WHERE clause to combine the current value with"); } WhereBuilder.Append(" OR ").Append(value); });
public PagedSelectCommandBuilder Where(string value) => this.Chain(() => { if (WhereBuilder.Length > 0) { WhereBuilder.Append(" AND "); } WhereBuilder.Append(value); });
public QuerySet <T> Where <TWhere1, TWhere2>(Expression <Func <TWhere1, TWhere2, bool> > exp) { var sqlWhere = new WhereExpression(exp, $"Where_{Params.ParameterNames.Count()}_", SqlProvider.ProviderOption); WhereBuilder.Append(sqlWhere.SqlCmd); if (sqlWhere.Param != null) { Params.AddDynamicParams(sqlWhere.Param); } return(this); }