using System; using System.Collections.Generic; using System.Text; using Ant.Frame; using Ant.Data; namespace Ant.ORM { /// /// 查询命令 /// public class QueryCommand { private static volatile QueryCommand instance = null; private static object lockHelper = new object(); /// /// 默认构造函数 /// public QueryCommand() { _parameters = new QueryParameterCollection(); } /// /// 申明对象 /// public static QueryCommand Instance { get { if (instance == null) { lock (lockHelper) { if (instance == null) { instance = new QueryCommand(); } } } return instance; } } /// /// 构造函数 /// /// 命令文本 /// 命令参数 public QueryCommand(string commandText, QueryParameterCollection parameters) { this._commandText = commandText; this._parameters = parameters; } /// /// 构造函数 /// /// SQL语句 public QueryCommand(string sqlString) { this._Key = string.Empty; this._moduleName = string.Empty; this._parameters = null; this._SqlType = SqlEnum.MainSql; this._SqlString = sqlString; } #region property private QueryParameterCollection _parameters; /// /// 命令参数集合 /// public QueryParameterCollection Parameters { get { return _parameters; } set { _parameters = value; } } private List _wherecolumn; /// /// 查询条件 /// public List WhereColumn { get { return _wherecolumn; } set { _wherecolumn = value; } } private string _moduleName; /// /// 模块 /// public string ModuleName { get { return this._moduleName; } set { this._moduleName = value; } } private string _Key; /// /// 关键字 /// public string Key { get { return this._Key; } set { this._Key = value; } } /// /// 参数符号 /// public string DbParmChar { get; set; } private SqlEnum _SqlType; /// /// SqlStruct类型 /// public SqlEnum SqlType { get { return this._SqlType; } set { this._SqlType = value; } } private string _commandText; /// /// 命令语句 /// public string CommandText { get { return _commandText; } set { _commandText = value; } } private string _SqlString; /// /// 拼接Sql语句 /// public string SqlString { get { return this._SqlString; } set { this._SqlString = value; } } private int _startRecord = 0; /// /// 开始记录数 /// public int StartRecord { get { return _startRecord; } set { _startRecord = value; } } private int _maxRecords = 0; /// /// 最大记录类 /// public int MaxRecords { get { return _maxRecords; } set { _maxRecords = value; } } private StringExtension.SqlComment sqlnotes; /// /// 添加SQL注释 /// public StringExtension.SqlComment SqlNotes { get { return sqlnotes; } set { sqlnotes = value; } } #endregion } }