<commit_before>﻿using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using SFA.DAS.EAS.Portal.Application.Services;

namespace SFA.DAS.EAS.Portal.DependencyResolution
{
    public static class ApplicationServices
    {
        public static IServiceCollection AddApplicationServices(this IServiceCollection services, HostBuilderContext hostBuilderContext)
        {
            services.AddScoped<IMessageContext, MessageContext>();            
            services.AddScoped<IMessageContextInitialisation, MessageContext>(sp => (MessageContext)sp.GetService<IMessageContext>());
            services.AddTransient<IAccountDocumentService, AccountDocumentService>();                        
            services.Decorate<IAccountDocumentService, AccountDocumentServiceWithSetProperties>();
            services.Decorate<IAccountDocumentService, AccountDocumentServiceWithDuplicateCheck>();

//            services.Scan(scan =>
//                    scan.FromAssembliesOf(typeof(ICommand<>))
//                    .AddClasses(classes =>
//                    classes.AssignableTo(typeof(ICommand<>)).Where(_ => !_.IsGenericType))
//                        .AsImplementedInterfaces()
//                        .WithTransientLifetime());

            return services;
        }
    }
}<commit_msg>scan event handlers<commit_after>﻿using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using SFA.DAS.EAS.Portal.Application.EventHandlers;
using SFA.DAS.EAS.Portal.Application.Services;

namespace SFA.DAS.EAS.Portal.DependencyResolution
{
    public static class ApplicationServices
    {
        public static IServiceCollection AddApplicationServices(this IServiceCollection services, HostBuilderContext hostBuilderContext)
        {
            services.AddScoped<IMessageContext, MessageContext>();            
            services.AddScoped<IMessageContextInitialisation, MessageContext>(sp => (MessageContext)sp.GetService<IMessageContext>());
            services.AddTransient<IAccountDocumentService, AccountDocumentService>();                        
            services.Decorate<IAccountDocumentService, AccountDocumentServiceWithSetProperties>();
            services.Decorate<IAccountDocumentService, AccountDocumentServiceWithDuplicateCheck>();

            services.Scan(scan => scan.FromAssembliesOf(typeof(IEventHandler<>))
                .AddClasses(classes => classes.AssignableTo(typeof(IEventHandler<>)).Where(_ => !_.IsGenericType))
                .AsImplementedInterfaces()
                .WithTransientLifetime());

            return services;
        }
    }
}
{'fraction_non_alphanumeric': 0.09152798789712557, 'fraction_numerical': 0.0, 'mean_word_length': 3.08179012345679, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 27, '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': '3140342', 'n_tokens_mistral': 632, 'n_tokens_neox': 622, 'n_words': 84}