Exemplo n.º 1
0
        /// <summary>
        /// Appends the specified <see cref="MdxSet"/> and returns the updated current instance of <see cref="MdxTuple"/>.
        /// If there are any children other than <see cref="MdxSet"/> then each child will be wrapped into <see cref="MdxSet"/>.
        /// </summary>
        /// <param name="set">Specified <see cref="MdxSet"/>.</param>
        /// <returns>Returns the updated current instance of <see cref="MdxTuple"/>.</returns>
        public MdxTuple With(MdxSet set)
        {
            if (!_children.Any())
            {
                _children.Add(set);

                return(this);
            }

            if (_children.OfType <MdxSet>().Any())
            {
                _children.Add(set);

                return(this);
            }

            var copiedChildren = new List <IMdxMember>(_children);

            _children.Clear();

            foreach (var member in copiedChildren)
            {
                _children.Add(Mdx.Set().With(member));
            }

            return(this);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Appends the specified <see cref="MdxTuple"/>, but wraps it into <see cref="MdxSet"/> and returns the updated
        /// current instance of <see cref="MdxTuple"/>. If there are any <see cref="MdxSet"/>s in <see cref="Children"/>
        /// then specified <see cref="MdxTuple"/> is appended to the last <see cref="MdxSet"/>.
        /// </summary>
        /// <param name="tuple">Specified <see cref="MdxTuple"/>.</param>
        /// <returns>Returns the updated current instance of <see cref="MdxTuple"/>.</returns>
        public MdxTuple With(MdxTuple tuple)
        {
            var lastSet = _children.OfType <MdxSet>().LastOrDefault();

            if (lastSet == null)
            {
                return(With(Mdx.Set().With(tuple)));
            }

            lastSet.With(tuple);

            return(this);
        }