/// <summary> /// 获取只取主键的SQL语句 /// </summary> internal string BuildKeyStringForRetrieve() { this._sqlString = SqlCommander.BuildForConditions(_conditions); string tempre = ""; //如果不能使用Where从句 if (_classMap.SuperClass == null && _sqlString == null) { tempre = this.GetSelectKeyClause(); } else { //如果未指定过滤条件,且_classMap.SuperClass !=null if (_sqlString == null) { tempre = GetSelectKeyClause() + " WHERE " + _classMap.StringForInherit; } //如果指定了过滤条件(_sqlString!= null) else { tempre = GetSelectKeyClause() + " WHERE " + _sqlString; } } //Order by if (this._orderList != null) { tempre += SelectCommander.GetOrderSql(_orderList, _classMap); } return(tempre); }
internal void BuildStringForRetrieve() { this._sqlString = SqlCommander.BuildForConditions(_conditions); //如果不能使用Where从句 if (_classMap.SuperClass == null && _sqlString == null) { _sqlString = GetSelectClause(); } else { //如果未指定过滤条件,且_classMap.SuperClass !=null if (_sqlString == null) { _sqlString = GetSelectClause() + " WHERE " + _classMap.StringForInherit; } //如果指定了过滤条件(_sqlString!= null) else { _sqlString = GetSelectClause() + " WHERE " + _sqlString; //且有父类 if (_classMap.SuperClass != null) { _sqlString += " AND " + _classMap.StringForInherit; } } } //Order by if (this._orderList != null) { this._sqlString += SelectCommander.GetOrderSql(_orderList, _classMap); } }
//Return select sql statment for association public IDbCommand GetSelectSqlFor(SelectionCriteria aSelectionCriteria) { if (select == null) { this.select = new SelectCommander(this); } return(this.select.BuildForSelectionCriteria(aSelectionCriteria)); }
public IDbCommand GetSelectSqlFor(EntityObject obj, bool WithNoLock) { if (select == null) { this.select = new SelectCommander(this); } return(this.select.BuildForObject(obj, WithNoLock)); }