Esempio n. 1
0
        private void GenerateSelect()
        {
            this._sql.AppendLine("SELECT");

            //生成第一个直接查询的表的所有列
            var rdp = RdbDataProvider.Get(this._directlyQueryRepository);
            var directlyQueryTableAlias   = this.GetTableAlias(rdp.DbTable.Name);
            var directlyQueryTableColumns = new SQLColumnsGenerator(this._directlyQueryRepository)
                                            .GetReadableColumnsSql(directlyQueryTableAlias);

            this._sql.Append(directlyQueryTableColumns).Append(',').AppendLine();

            //依次添加其它关系表的所有列
            var items = this._aggregateInfo.Items;

            foreach (var item in items)
            {
                var tableName  = RdbDataProvider.Get(item.PropertyEntityRepository).DbTable.Name;
                var tableAlias = GetTableAlias(tableName);
                var columns    = new SQLColumnsGenerator(item.PropertyEntityRepository);
                var sqlColumns = columns.GetReadableColumnsSql(tableAlias);

                this._sql.Append(sqlColumns);
                if (item != items.Last.Value)
                {
                    this._sql.Append(',');
                }
                this._sql.AppendLine();
            }
        }
Esempio n. 2
0
        private void GenerateSelect()
        {
            this._sql.AppendLine("SELECT");

            //生成第一个直接查询的表的所有列
            var rdp = RdbDataProvider.Get(this._directlyQueryRepository);
            var directlyQueryTableAlias = this.GetTableAlias(rdp.DbTable.Name);
            var directlyQueryTableColumns = new SQLColumnsGenerator(this._directlyQueryRepository)
                .GetReadableColumnsSql(directlyQueryTableAlias);
            this._sql.Append(directlyQueryTableColumns).Append(',').AppendLine();

            //依次添加其它关系表的所有列
            var items = this._aggregateInfo.Items;
            foreach (var item in items)
            {
                var tableName = RdbDataProvider.Get(item.PropertyEntityRepository).DbTable.Name;
                var tableAlias = GetTableAlias(tableName);
                var columns = new SQLColumnsGenerator(item.PropertyEntityRepository);
                var sqlColumns = columns.GetReadableColumnsSql(tableAlias);

                this._sql.Append(sqlColumns);
                if (item != items.Last.Value)
                {
                    this._sql.Append(',');
                }
                this._sql.AppendLine();
            }
        }