private BindingSourceMethod CreateBindingSourceMethod(CodeFunction codeFunction, BindingSourceType bindingSourceType, IdeBindingSourceProcessor bindingSourceProcessor)
 {
     try
     {
         var filteredAttributes = codeFunction.Attributes.Cast<CodeAttribute2>().Where(attr => bindingSourceProcessor.CanProcessTypeAttribute(attr.FullName)).ToArray();
         return bindingReflectionFactory.CreateBindingSourceMethod(codeFunction, bindingSourceType, filteredAttributes);
     }
     catch (Exception ex)
     {
         tracer.Trace("CreateBindingSourceMethod error: {0}", this, ex);
         return null;
     }
 }
        private void ProcessCodeClass(CodeClass codeClass, IdeBindingSourceProcessor bindingSourceProcessor)
        {
            var filteredAttributes = codeClass.Attributes.Cast<CodeAttribute2>().Where(attr => bindingSourceProcessor.CanProcessTypeAttribute(attr.FullName)).ToArray();
            if (!bindingSourceProcessor.PreFilterType(filteredAttributes.Select(attr => attr.FullName)))
                return;

            var bindingSourceType = bindingReflectionFactory.CreateBindingSourceType(codeClass, filteredAttributes);

            if (!bindingSourceProcessor.ProcessType(bindingSourceType))
                return;

            foreach (var codeFunction in codeClass.Children.OfType<CodeFunction>())
            {
                bindingSourceProcessor.ProcessMethod(CreateBindingSourceMethod(codeFunction, bindingSourceType, bindingSourceProcessor));
            }

            bindingSourceProcessor.ProcessTypeDone();
        }
        private static bool CanProcessTypeAttribute(IdeBindingSourceProcessor bindingSourceProcessor, CodeAttribute2 attr)
        {
            string attributeTypeName;
            try
            {
                attributeTypeName = attr.FullName;
            }
            catch (Exception)
            {
                // invalid attribute - ignore
                return false;
            }

            return bindingSourceProcessor.CanProcessTypeAttribute(attributeTypeName);
        }
 private BindingSourceMethod CreateBindingSourceMethod(CodeFunction codeFunction, BindingSourceType bindingSourceType, IdeBindingSourceProcessor bindingSourceProcessor)
 {
     var filteredAttributes = codeFunction.Attributes.Cast<CodeAttribute2>().Where(attr => bindingSourceProcessor.CanProcessTypeAttribute(attr.FullName)).ToArray();
     return bindingReflectionFactory.CreateBindingSourceMethod(codeFunction, bindingSourceType, filteredAttributes);
 }