private void SetGraphQLTypeName()

in src/Epam.GraphQL/Configuration/RelationRegistry.cs [817:836]


        private void SetGraphQLTypeName(Type? projectionType, Type entityType, string? oldName, string newName)
        {
            if (TryGetRegisteredType(newName, out var oldType))
            {
                Guards.ThrowInvalidOperationIf(
                    oldType.Entity != entityType || (oldType.Projection != null && !oldType.Projection.IsAssignableFrom(projectionType)),
                    $"Configuration already contains different type `{oldType.Entity.HumanizedName()}` with name `{newName}`");

                return;
            }

            if (oldName != null && TryGetRegisteredType(oldName, out oldType))
            {
                Guards.ThrowNotSupportedIf((entityType, projectionType) != oldType);

                UnregisterProjectionType(oldName);
            }

            RegisterProjectionType(newName, entityType, projectionType);
        }