示例#1
0
        /// <summary>
        /// Converts the event bean into a contract event.
        /// </summary>
        /// <param name="eventBean">The event bean.</param>
        /// <returns></returns>
        public static XElement ToXElement(this EventBean eventBean)
        {
            if (eventBean.Underlying is XElement)
            {
                return((XElement)eventBean.Underlying);
            }

            var renderingOptions = new XMLRenderingOptions {
                IsDefaultAsAttribute = false, PreventLooping = true
            };
            var elementRendererImpl = new XElementRendererImpl(eventBean.EventType, renderingOptions);

            return(elementRendererImpl.Render(
                       "eventBean", eventBean));
        }
        /// <summary>
        /// Converts the event bean into a contract event.
        /// </summary>
        /// <param name="eventBean">The event bean.</param>
        /// <returns></returns>
        public static XElement ToXElement(this EventBean eventBean)
        {
            if (eventBean.Underlying is XElement) {
                return (XElement) eventBean.Underlying;
            }

            var renderingOptions = new XMLRenderingOptions();
            renderingOptions.IsDefaultAsAttribute = false;
            renderingOptions.PreventLooping = true;

            var elementRendererImpl = new XElementRendererImpl(eventBean.EventType, renderingOptions);

            return elementRendererImpl.Render(
                "eventBean", eventBean);
        }