예제 #1
0
        private static AttributeNodeCollection GetDefiningAttributes(Method method)
        {
            AttributeNodeCollection definingAttributes;

            Method[] interfaceDeclarations = IntrospectionUtility.InterfaceDeclarations(method);

            if (interfaceDeclarations.Any())
            {
                definingAttributes = interfaceDeclarations.First().ReturnAttributes;
            }
            else if (FragmentUtility.IsAnnotatedPropertyGetter(method))
            {
                definingAttributes = method.DeclaringMember.Attributes;
            }
            else
            {
                definingAttributes = method.ReturnAttributes;
            }

            return(definingAttributes);
        }
예제 #2
0
        public static Fragment ReturnFragmentType(Method method)
        {
            ArgumentUtility.CheckNotNull("method", method);
            var    returnFragment = Fragment.CreateEmpty();
            Method determiningMethod;

            Method[] interfaceDeclarations = IntrospectionUtility.InterfaceDeclarations(method);
            if (interfaceDeclarations.Any())
            {
                determiningMethod = interfaceDeclarations.First();
            }
            else
            {
                determiningMethod = method;
            }

            if (determiningMethod.ReturnAttributes != null && ContainsFragment(determiningMethod.ReturnAttributes))
            {
                returnFragment = GetFragmentType(determiningMethod.ReturnAttributes);
            }
            return(returnFragment);
        }