AgentMulder.Containers.Autofac.Patterns.FromAssemblies.BasedOn.AssignableToNonGeneric.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 argument = match.GetMatchedElement("argument") as ICSharpArgument;
            if (argument == null)
            {
                yield break;
            }

            var typeofExpression = argument.Value as ITypeofExpression;
            if (typeofExpression != null)
            {
                var declaredType = typeofExpression.ArgumentType as IDeclaredType;
                if (declaredType != null)
                {
                    ITypeElement typeElement = declaredType.GetTypeElement();
                    if (typeElement != null)
                    {
                        // todo possible bug: same as in the generic variant. Currently works the same as As<T>.
                        yield return new ServiceRegistration(registrationRootElement, typeElement);
                    }
                }
            }
        }