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

                return(this);
            }

            if (_children.OfType <MdxTuple>().Any())
            {
                _children.Add(tuple);

                return(this);
            }

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

            _children.Clear();

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

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

            if (lastTuple == null)
            {
                With(Mdx.Tuple().With(set));

                return(this);
            }

            lastTuple.With(set);

            return(this);
        }