Ejemplo n.º 1
0
        /// <summary>
        /// Having句 にコンストラクタで指定された条件式を追加する。
        /// </summary>
        /// <param name="node">Having句</param>
        public override void ExplicitVisit(Microsoft.SqlServer.TransactSql.ScriptDom.HavingClause node)
        {
            try
            {
                var booleanExpression = FindBooleanExpression.Compile().Invoke(node);
                if (booleanExpression != null && BooleanBinaryExpressionType.HasValue)
                {
                    booleanExpression = new BooleanBinaryExpression()
                    {
                        BinaryExpressionType = BooleanBinaryExpressionType.Value,
                        FirstExpression      = booleanExpression,
                        SecondExpression     = BooleanExpression,
                    };

                    var booleanBinaryExpression = (BooleanBinaryExpression)booleanExpression;
                }
                else
                {
                    booleanExpression = BooleanExpression;
                }

                var member = (MemberExpression)FindBooleanExpression.Body;
                var param  = Expression.Parameter(typeof(BooleanExpression), "value");
                var set    = Expression.Lambda <Action <Microsoft.SqlServer.TransactSql.ScriptDom.HavingClause, BooleanExpression> >(
                    Expression.Assign(member, param), FindBooleanExpression.Parameters[0], param);
                set.Compile().Invoke(node, booleanExpression);
            }
            catch (Exception e)
            {
                throw new InvalidOperationException("指定された条件式は追加できません。", e);
            }

            base.ExplicitVisit(node);
        }
Ejemplo n.º 2
0
 public HavingClause(ScriptDom.HavingClause src) : base(src)
 {
     this.SearchCondition = Copier.Copy <BooleanExpression>(src.SearchCondition);
 }