Example #1
0
    private static void TryMapToExistingRegistration(
        ITypeRegistrar typeRegistrar,
        ITypeInfo typeInfo,
        TypeContext context,
        string?scope)
    {
        ExtendedTypeReference?normalizedTypeRef = null;
        var resolved = false;

        foreach (TypeComponent component in typeInfo.Components)
        {
            normalizedTypeRef = TypeReference.Create(
                component.Type,
                context,
                scope);

            if (typeRegistrar.IsResolved(normalizedTypeRef))
            {
                resolved = true;
                break;
            }
        }

        if (!resolved && normalizedTypeRef is not null)
        {
            typeRegistrar.MarkUnresolved(normalizedTypeRef);
        }
    }