<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace JustGiving.EventStore.Http.SubscriberHost
{
    public class EventTypeResolver : IEventTypeResolver
    {
        Dictionary<string, Type> cache = new Dictionary<string,Type>();

        public Type Resolve(string fullName)
        {
            Type result;
            if (cache.TryGetValue(fullName, out result))
            {
                return result;
            }

            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                var match = assembly.GetTypes().FirstOrDefault(x => x.FullName == fullName);
                if (match != null)
                {
                    return match;
                }
            }

            return null;
        }
    }
}<commit_msg>EventTypeResolver actually caches now...<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace JustGiving.EventStore.Http.SubscriberHost
{
    public class EventTypeResolver : IEventTypeResolver
    {
        private Dictionary<string, Type> cache = new Dictionary<string,Type>();

        public Type Resolve(string fullName)
        {
            Type result;
            if (cache.TryGetValue(fullName, out result))
            {
                return result;
            }

            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                var match = assembly.GetTypes().FirstOrDefault(x => x.FullName == fullName);
                if (match != null)
                {
                    cache[fullName] = match;
                    return match;
                }
            }

            return null;
        }
    }
}
{'fraction_non_alphanumeric': 0.0857307249712313, 'fraction_numerical': 0.0, 'mean_word_length': 1.5994020926756354, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '4906687', 'n_tokens_mistral': 440, 'n_tokens_neox': 421, 'n_words': 98}