예제 #1
0
        internal static XTypedElement GetAnnotation(Type t, XElement xe)
        {
            XTypedElementWrapperAnnotation xoWrapperAnnotation = xe.Annotation <XTypedElementWrapperAnnotation>();
            XTypedElement xObj = null;

            if (xoWrapperAnnotation != null)
            {
                //Return the root type if the element is annotated with the root
                xObj = xoWrapperAnnotation.typedElement;
                if (t.IsAssignableFrom(xObj.GetType()))
                {
                    //Check if we are asking for element wrapper
                    return(xObj);
                }
            }

            XTypedElementAnnotation xoAnnotation = xe.Annotation <XTypedElementAnnotation>();

            if (xoAnnotation != null)
            {
                xObj = xoAnnotation.typedElement;
                if (t.IsAssignableFrom(xObj.GetType()))
                {
                    //Check if we are asking for type
                    return(xObj);
                }
            }

            return(null);
        }
예제 #2
0
        internal static XTypedElement GetAnnotation(Type t, XElement xe)
        {
            XTypedElement xTypedElement;
            XTypedElementWrapperAnnotation xoWrapperAnnotation = xe.Annotation <XTypedElementWrapperAnnotation>();
            XTypedElement xObj = null;

            if (xoWrapperAnnotation != null)
            {
                xObj = xoWrapperAnnotation.typedElement;
                if (t.IsAssignableFrom(xObj.GetType()))
                {
                    xTypedElement = xObj;
                    return(xTypedElement);
                }
            }
            XTypedElementAnnotation xoAnnotation = xe.Annotation <XTypedElementAnnotation>();

            if (xoAnnotation != null)
            {
                xObj = xoAnnotation.typedElement;
                if (t.IsAssignableFrom(xObj.GetType()))
                {
                    xTypedElement = xObj;
                    return(xTypedElement);
                }
            }
            xTypedElement = null;
            return(xTypedElement);
        }
예제 #3
0
        XTypedElement getTypedParent()
        {
            XElement parentElement = this.Untyped.Parent;

            if (parentElement != null)
            {
                XTypedElementAnnotation annotation = parentElement.Annotation <XTypedElementAnnotation>();
                if (annotation != null)
                {
                    return(annotation.typedElement);
                }
            }
            return(null);
        }
예제 #4
0
        private XTypedElement getTypedParent()
        {
            XTypedElement xTypedElement;
            XElement      parentElement = this.Untyped.Parent;

            if (parentElement != null)
            {
                XTypedElementAnnotation annotation = parentElement.Annotation <XTypedElementAnnotation>();
                if (annotation != null)
                {
                    xTypedElement = annotation.typedElement;
                    return(xTypedElement);
                }
            }
            xTypedElement = null;
            return(xTypedElement);
        }