Beispiel #1
0
        /// <summary>
        /// 获取列名列表
        /// </summary>
        /// <param name="dialect">Sql方言</param>
        /// <param name="register">实体别名注册器</param>
        public string ToSql(IDialect dialect, IEntityAliasRegister register)
        {
            if (Raw || IsAggregation)
            {
                return(dialect.GetColumn(Name, dialect.GetSafeName(ColumnAlias)));
            }
            var result = new SqlItem(Name, GetTableAlias(register), ColumnAlias, isResolve: false);

            return(result.ToSql(dialect));
        }
Beispiel #2
0
        /// <summary>
        /// 创建列
        /// </summary>
        private ColumnItem CreateItem(string column, string tableAlias)
        {
            var item = new SqlItem(column, tableAlias);

            return(new ColumnItem(item.Name, item.Prefix, item.Alias));
        }
Beispiel #3
0
        /// <summary>
        /// 创建列
        /// </summary>
        private ColumnItem CreateItem(string column, Type tableType, string columnAlias = null)
        {
            var item = new SqlItem(column, alias: columnAlias);

            return(new ColumnItem(item.Name, columnAlias: item.Alias, tableType: tableType));
        }
Beispiel #4
0
 /// <summary>
 /// 初始化表连接项
 /// </summary>
 /// <param name="joinType">连接类型</param>
 /// <param name="table">表名</param>
 /// <param name="schema">架构</param>
 /// <param name="alias">别名</param>
 /// <param name="raw">使用原始值</param>
 /// <param name="isSplit">是否用句点分割表名</param>
 /// <param name="type">表实体类型</param>
 public JoinItem(string joinType, string table, string schema = null, string alias = null, bool raw = false, bool isSplit = true, Type type = null)
 {
     JoinType = joinType;
     Table    = new SqlItem(table, schema, alias, raw, isSplit);
     Type     = type;
 }
Beispiel #5
0
 /// <summary>
 /// 初始化连接条件项
 /// </summary>
 /// <param name="left">左表列名</param>
 /// <param name="right">右表列名</param>
 /// <param name="operator">条件运算符</param>
 public OnItem(SqlItem left, SqlItem right, Operator @operator)
 {
     Left     = left;
     Right    = right;
     Operator = @operator;
 }
Beispiel #6
0
 /// <summary>
 /// 初始化连接条件项
 /// </summary>
 /// <param name="left">左表列名</param>
 /// <param name="right">右表列名</param>
 /// <param name="operator">条件运算符</param>
 public OnItem(string left, string right, Operator @operator)
 {
     Left     = new SqlItem(left);
     Right    = new SqlItem(right);
     Operator = @operator;
 }
Beispiel #7
0
 /// <summary>
 /// 初始化表连接项
 /// </summary>
 /// <param name="joinType">连接类型</param>
 /// <param name="table">表</param>
 /// <param name="conditions">连接条件列表</param>
 public JoinItem(string joinType, SqlItem table, List <List <OnItem> > conditions)
 {
     JoinType   = joinType;
     Table      = table;
     Conditions = conditions;
 }
Beispiel #8
0
 /// <summary>
 /// 初始化表连接项
 /// </summary>
 /// <param name="joinType">连接类型</param>
 /// <param name="table">表名</param>
 /// <param name="schema">架构</param>
 /// <param name="alias">别名</param>
 /// <param name="raw">使用原始值</param>
 /// <param name="isSplit">是否用句点分割表名</param>
 public JoinItem(string joinType, string table, string schema = null, string alias = null, bool raw = false, bool isSplit = true)
 {
     JoinType   = joinType;
     Table      = new SqlItem(table, schema, alias, raw, isSplit);
     Conditions = new List <List <OnItem> >();
 }