<commit_before>namespace Cedar.HttpCommandHandling
{
    using System;
    using System.Collections.Generic;
    using Cedar.HttpCommandHandling.TinyIoC;

    public class CommandHandlerResolver : ICommandHandlerResolver
    {
        private readonly TinyIoCContainer _container = new TinyIoCContainer();
        private readonly HashSet<Type> _knownCommandTypes = new HashSet<Type>();

        public CommandHandlerResolver(params CommandHandlerModule[] commandHandlerModules)
        {
            foreach(var module in commandHandlerModules)
            {
                foreach(var handlerRegistration in module.HandlerRegistrations)
                {
                    if (!_knownCommandTypes.Add(handlerRegistration.MessageType))
                    {
                        throw new InvalidOperationException(
                            "Attempt to register multiple handlers for command type {0}"
                                .FormatWith(handlerRegistration.MessageType));
                    }

                    _container.Register(
                        handlerRegistration.RegistrationType,
                        handlerRegistration.HandlerInstance);
                }
            }
        }

        public IEnumerable<Type> KnownCommandTypes
        {
            get { return _knownCommandTypes; }
        }

        public Handler<CommandMessage<TCommand>> Resolve<TCommand>() where TCommand : class
        {
            return _container.Resolve<Handler<CommandMessage<TCommand>>>();
        }
    }
}<commit_msg>CommandHandlerResolver is not using a container.<commit_after>namespace Cedar.HttpCommandHandling
{
    using System;
    using System.Collections.Generic;

    public class CommandHandlerResolver : ICommandHandlerResolver
    {
        private readonly HashSet<Type> _knownCommandTypes = new HashSet<Type>();
        private readonly Dictionary<Type, object> _handlers = new Dictionary<Type, object>(); 

        public CommandHandlerResolver(params CommandHandlerModule[] commandHandlerModules)
        {
            foreach(var module in commandHandlerModules)
            {
                foreach(var handlerRegistration in module.HandlerRegistrations)
                {
                    if (!_knownCommandTypes.Add(handlerRegistration.MessageType))
                    {
                        throw new InvalidOperationException(
                            "Attempt to register multiple handlers for command type {0}"
                                .FormatWith(handlerRegistration.MessageType));
                    }
                    _handlers[handlerRegistration.RegistrationType] = handlerRegistration.HandlerInstance;
                }
            }
        }

        public IEnumerable<Type> KnownCommandTypes
        {
            get { return _knownCommandTypes; }
        }

        public Handler<CommandMessage<TCommand>> Resolve<TCommand>() where TCommand : class
        {
            object handler;
            if(_handlers.TryGetValue(typeof(Handler<CommandMessage<TCommand>>), out handler))
            {
                return (Handler<CommandMessage<TCommand>>) handler;
            }
            return null;
        }
    }
}
{'fraction_non_alphanumeric': 0.0660436137071651, 'fraction_numerical': 0.0006230529595015577, 'mean_word_length': 1.903254972875226, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, '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': '4226272', 'n_tokens_mistral': 715, 'n_tokens_neox': 676, 'n_words': 148}