Beispiel #1
0
        /// <summary>
        /// コンストラクタ、親ノードと結合種類、テーブル、結合式を指定して初期化する
        /// </summary>
        /// <param name="parent">親ノード</param>
        /// <param name="joinType">結合種類</param>
        /// <param name="table">結合するテーブル</param>
        /// <param name="on">結合式</param>
        public Join(IQueryNode parent, JoinType joinType, ITable <TColumns> table, Expression <Func <TColumns, bool> > on)
        {
            var select = table as ISelect <TColumns>;

            if (select is null)
            {
                table = table.AliasedClone();
            }
            else
            {
                QueryNodeHelper.SwitchParent(select, this);
            }

            this.Parent   = parent;
            this.JoinType = joinType;
            this.Table    = table;
            this.Columns  = table.Columns;

            this.Owner.RegisterTable(table);

            this.On = new ElementCode(
                ParameterReplacer.Replace(
                    on.Body,
                    new Dictionary <Expression, object> {
                { on.Parameters[0], table.Columns }
            }
                    ),
                this.Owner.AllColumns
                );
        }
Beispiel #2
0
        /// <summary>
        /// コンストラクタ、親ノードと取得元のテーブル定義を指定して初期化する
        /// </summary>
        /// <param name="parent">親ノード</param>
        /// <param name="tableDef">テーブル定義</param>
        public From(IQueryNode parent, ITable <TColumns> tableDef)
        {
            this.Parent = parent;

            var clone = tableDef.AliasedClone();

            this.Table   = clone;
            this.Columns = clone.Columns;

            parent.Owner.Register(clone);
        }
Beispiel #3
0
        public From(IQueryNode parent, ITable <TColumns> table)
        {
            var select = table as ISelect <TColumns>;

            if (select is null)
            {
                table = table.AliasedClone();
            }
            else
            {
                QueryNodeHelper.SwitchParent(select, this);
            }

            this.Parent  = parent;
            this.Table   = table;
            this.Columns = table.Columns;

            this.Owner.RegisterTable(table);
        }
Beispiel #4
0
        /// <summary>
        /// コンストラクタ、親ノードと結合種類、テーブル、結合式を指定して初期化する
        /// </summary>
        /// <param name="parent">親ノード</param>
        /// <param name="joinType">結合種類</param>
        /// <param name="table">結合するテーブル</param>
        /// <param name="on">結合式</param>
        public Join(IQueryNode parent, JoinType joinType, ITable <TColumns> table, Expression <Func <TColumns, bool> > on)
        {
            var clone = table.AliasedClone();

            this.Parent   = parent;
            this.JoinType = joinType;
            this.Table    = clone;
            this.Columns  = clone.Columns;

            this.Owner.Register(clone);

            this.On = new ElementCode(
                ParameterReplacer.Replace(
                    on.Body,
                    new Dictionary <Expression, object> {
                { on.Parameters[0], clone.Columns }
            }
                    ),
                this.Owner.AllColumns
                );
        }