AgentMulder.Containers.Autofac.Patterns.FromAssemblies.BasedOn.AsNonGeneric.DoCreateRegistrations C# (CSharp) Method

DoCreateRegistrations() protected method

protected DoCreateRegistrations ( ITreeNode registrationRootElement, IStructuralMatchResult match ) : IEnumerable
registrationRootElement ITreeNode
match IStructuralMatchResult
return IEnumerable
        protected override IEnumerable<FilteredRegistrationBase> DoCreateRegistrations(ITreeNode registrationRootElement, IStructuralMatchResult match)
        {
            var arguments = match.GetMatchedElementList("arguments").Cast<ICSharpArgument>();

            foreach (var argument in arguments)
            {
                // match typeof() expressions
                var typeOfExpression = argument.Value as ITypeofExpression;
                if (typeOfExpression != null)
                {
                    var argumentType = typeOfExpression.ArgumentType as IDeclaredType;
                    if (argumentType != null)
                    {
                        var typeElement = argumentType.GetTypeElement();
                        if (typeElement == null) // can happen if the typeof() expression is empty
                        {
                            yield break;
                        }

                        yield return new ServiceRegistration(registrationRootElement, typeElement);
                    }
                }
            }
        }