protected override INamespace GetNamespaceElement(IStructuralMatchResult match, out bool includeSubnamespaces)
        {
            includeSubnamespaces = false;
            var argument = match.GetMatchedElement("subnamespace") as ICSharpArgument;
            if (argument != null)
            {
                if (argument.Value.ConstantValue != null &&
                    argument.Value.ConstantValue.IsBoolean())
                {
                    includeSubnamespaces = Convert.ToBoolean(argument.Value.ConstantValue.Value);
                }
            }

            var declaredType = match.GetMatchedType("type") as IDeclaredType;
            if (declaredType != null)
            {
                ITypeElement typeElement = declaredType.GetTypeElement();
                if (typeElement != null)
                {
                    return typeElement.GetContainingNamespace();
                }
            }

            return null;
        }
示例#2
0
 protected override IEnumerable<FilteredRegistrationBase> DoCreateRegistrations(ITreeNode registrationRootElement, IStructuralMatchResult match)
 {
     var matchedType = match.GetMatchedType("type") as IDeclaredType;
     if (matchedType != null)
     {
         ITypeElement typeElement = matchedType.GetTypeElement();
         if (typeElement != null)
         {
             yield return new ExceptRegistration(registrationRootElement, typeElement);
         }
     }
 }
 protected override IEnumerable<FilteredRegistrationBase> DoCreateRegistrations(ITreeNode registrationRootElement, IStructuralMatchResult match)
 {
     var declaredType = match.GetMatchedType("type") as IDeclaredType;
     if (declaredType != null)
     {
         ITypeElement typeElement = declaredType.GetTypeElement();
         if (typeElement != null)
         {
             yield return new InNamespaceRegistration(registrationRootElement, typeElement.GetContainingNamespace(), true);
         }
     }
 }
 protected override IEnumerable<BasedOnRegistrationBase> DoCreateRegistrations(ITreeNode registrationRootElement, IStructuralMatchResult match)
 {
     var matchedType = match.GetMatchedType("service") as IDeclaredType;
     if (matchedType != null)
     {
         ITypeElement typeElement = matchedType.GetTypeElement();
         if (typeElement != null)
         {
             // todo possible bug here. Investigate wheather As and AssignableTo differ somehow in the result.
             yield return new ElementBasedOnRegistration(registrationRootElement, typeElement);
         }
     }
 }
示例#5
0
        protected override IEnumerable <FilteredRegistrationBase> DoCreateRegistrations(ITreeNode registrationRootElement, IStructuralMatchResult match)
        {
            var declaredType = match.GetMatchedType("type") as IDeclaredType;

            if (declaredType != null)
            {
                ITypeElement typeElement = declaredType.GetTypeElement();
                if (typeElement != null)
                {
                    yield return(new InNamespaceRegistration(registrationRootElement, typeElement.GetContainingNamespace(), true));
                }
            }
        }
示例#6
0
        protected override IEnumerable <FilteredRegistrationBase> DoCreateRegistrations(ITreeNode registrationRootElement, IStructuralMatchResult match)
        {
            var matchedType = match.GetMatchedType("service") as IDeclaredType;

            if (matchedType != null)
            {
                ITypeElement typeElement = matchedType.GetTypeElement();
                if (typeElement != null)
                {
                    yield return(new ServiceRegistration(registrationRootElement, typeElement));
                }
            }
        }
示例#7
0
        protected override IEnumerable <FilteredRegistrationBase> DoCreateRegistrations(ITreeNode registrationRootElement, IStructuralMatchResult match)
        {
            var matchedType = match.GetMatchedType("service") as IDeclaredType;

            if (matchedType != null)
            {
                ITypeElement typeElement = matchedType.GetTypeElement();
                if (typeElement != null)
                {
                    // todo possible bug here. Investigate wheather As and AssignableTo differ somehow in the result.
                    yield return(new ServiceRegistration(registrationRootElement, typeElement));
                }
            }
        }
        protected override INamespace GetNamespaceElement(IStructuralMatchResult match, out bool includeSubnamespaces)
        {
            includeSubnamespaces = true;

            var declaredType = match.GetMatchedType("type") as IDeclaredType;
            if (declaredType != null)
            {
                ITypeElement typeElement = declaredType.GetTypeElement();
                if (typeElement != null)
                {
                    return typeElement.GetContainingNamespace();
                }
            }

            return null;
        }
示例#9
0
        public override IEnumerable <BasedOnRegistrationBase> GetBasedOnRegistrations(ITreeNode registrationRootElement)
        {
            IStructuralMatchResult match = Match(registrationRootElement);

            if (match.Matched)
            {
                var declaredType = match.GetMatchedType("attribute") as IDeclaredType;
                if (declaredType != null)
                {
                    var typeElement = declaredType.GetTypeElement();
                    if (typeElement != null)
                    {
                        yield return(new HasAttributeRegistration(registrationRootElement, typeElement));
                    }
                }
            }
        }
示例#10
0
        protected override INamespace GetNamespaceElement(IStructuralMatchResult match, out bool includeSubnamespaces)
        {
            includeSubnamespaces = true;

            var declaredType = match.GetMatchedType("type") as IDeclaredType;

            if (declaredType != null)
            {
                ITypeElement typeElement = declaredType.GetTypeElement();
                if (typeElement != null)
                {
                    return(typeElement.GetContainingNamespace());
                }
            }

            return(null);
        }
        public override IEnumerable <FilteredRegistrationBase> GetBasedOnRegistrations(ITreeNode registrationRootElement)
        {
            IStructuralMatchResult match = Match(registrationRootElement);

            if (match.Matched)
            {
                var matchedType = match.GetMatchedType("type") as IDeclaredType;
                if (matchedType != null)
                {
                    ITypeElement typeElement = matchedType.GetTypeElement();
                    if (typeElement != null)
                    {
                        yield return(new ServiceRegistration(registrationRootElement, typeElement));
                    }
                }
            }
        }
        public override IEnumerable <IComponentRegistration> GetComponentRegistrations(ITreeNode registrationRootElement)
        {
            IStructuralMatchResult match = Match(registrationRootElement);

            if (match.Matched)
            {
                var matchedType = match.GetMatchedType(elementName) as IDeclaredType;
                if (matchedType != null)
                {
                    ITypeElement typeElement = matchedType.GetTypeElement();
                    if (typeElement != null) // can be null in case of broken reference (unresolved type)
                    {
                        yield return(new ComponentRegistration(registrationRootElement, typeElement));
                    }
                }
            }
        }
示例#13
0
 protected override IModule GetTargetModule(IStructuralMatchResult match)
 {
     return(ModuleExtractor.GetTargetModule(match.GetMatchedType("type")));
 }
 protected override IModule GetTargetModule(IStructuralMatchResult match)
 {
     return ModuleExtractor.GetTargetModule(match.GetMatchedType("type"));
 }