<commit_before>﻿using System;
using System.Linq;
using Nimbus.Handlers;

namespace Nimbus.Extensions
{
    public static class TypeProviderExtensions
    {
        public static Type[] AllHandlerTypes(this ITypeProvider typeProvider)
        {
            return new Type[0]
                .Union(typeProvider.CommandHandlerTypes)
                .Union(typeProvider.MulticastEventHandlerTypes)
                .Union(typeProvider.CompetingEventHandlerTypes)
                .Union(typeProvider.RequestHandlerTypes)
                .ToArray();
        }

        public static Type[] AllClosedGenericHandlerInterfaces(this ITypeProvider typeProvider)
        {
            return typeProvider.AllHandlerTypes()
                               .Where(typeProvider.IsClosedGenericHandlerInterface)
                               .ToArray();
        }

        public static Type[] AllMessageContractTypes(this ITypeProvider typeProvider)
        {
            return new Type[0]
                .Union(typeProvider.CommandTypes)
                .Union(typeProvider.EventTypes)
                .Union(typeProvider.RequestTypes)
                .ToArray();
        }

        public static bool IsClosedGenericHandlerInterface(this ITypeProvider typeProvider, Type potentialHandlerType)<commit_msg>Type provider extension now correctly returns closed generic handler interface types.<commit_after>﻿using System;
using System.Linq;
using Nimbus.Handlers;

namespace Nimbus.Extensions
{
    public static class TypeProviderExtensions
    {
        public static Type[] AllHandlerTypes(this ITypeProvider typeProvider)
        {
            return new Type[0]
                .Union(typeProvider.CommandHandlerTypes)
                .Union(typeProvider.MulticastEventHandlerTypes)
                .Union(typeProvider.CompetingEventHandlerTypes)
                .Union(typeProvider.RequestHandlerTypes)
                .ToArray();
        }

        public static Type[] AllClosedGenericHandlerInterfaces(this ITypeProvider typeProvider)
        {
            return typeProvider.AllHandlerTypes()
                               .SelectMany(t => t.GetInterfaces())
                               .Where(typeProvider.IsClosedGenericHandlerInterface)
                               .ToArray();
        }

        public static Type[] AllMessageContractTypes(this ITypeProvider typeProvider)
        {
            return new Type[0]
                .Union(typeProvider.CommandTypes)
                .Union(typeProvider.EventTypes)
                .Union(typeProvider.RequestTypes)
                .ToArray();
        }

        public static bool IsClosedGenericHandlerInterface(this ITypeProvider typeProvider, Type potentialHandlerType)
{'fraction_non_alphanumeric': 0.06490649064906491, 'fraction_numerical': 0.0014668133480014668, 'mean_word_length': 2.0651685393258425, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3863110', 'n_tokens_mistral': 632, 'n_tokens_neox': 604, 'n_words': 125}