/// <summary> /// 获取列名列表 /// </summary> /// <param name="dialect">Sql方言</param> /// <param name="register">实体别名注册器</param> public string ToSql(IDialect dialect, IEntityAliasRegister register) { if (Raw || IsAggregation && TableType == null && string.IsNullOrWhiteSpace(AggregationFunc)) { return(dialect.GetColumn(Name, dialect.GetSafeName(ColumnAlias))); } var result = new SqlItem(Name, GetTableAlias(register), ColumnAlias, isResolve: false, aggregationFunc: AggregationFunc); return(result.ToSql(dialect)); }
/// <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)); }
/// <summary> /// 获取Sql /// </summary> /// <param name="dialect">Sql方言</param> /// <param name="tableDatabase">表数据库</param> public virtual string ToSql(IDialect dialect = null, ITableDatabase tableDatabase = null) { if (string.IsNullOrWhiteSpace(Name)) { return(null); } if (Raw) { return(Name); } var column = GetColumn(dialect, tableDatabase); var columnAlias = GetSafeName(dialect, Alias); return(dialect.GetColumn(column, columnAlias)); }