コード例 #1
0
        protected override Expression VisitNew(NewExpression n)
        {
            var list = _dbFactory.BuildList <DbKeyValue>();

            if (n.Members != null)
            {
                for (var i = 0; i < n.Members.Count; i++)
                {
                    var member     = n.Members[i];
                    var assignment = n.Arguments[i];

                    Visit(assignment);

                    var dbObj      = _state.ResultStack.Pop();
                    var dbKeyValue = _dbFactory.BuildKeyValue(member.Name, dbObj);
                    list.Add(dbKeyValue);
                }

                _state.ResultStack.Push(list);
                return(n);
            }

            _state.ResultStack.Push(list);
            return(base.VisitNew(n));
        }