using System.Reflection; using Microsoft.Extensions.DependencyInjection; using Supercell.GUT.Server.Protocol.Attributes; namespace Supercell.GUT.Server.Protocol.Extensions; internal static class ServiceCollectionExtensions { public static IServiceCollection AddHandlers(this IServiceCollection services) { IEnumerable types = Assembly.GetExecutingAssembly().GetTypes() .Where(t => t.GetCustomAttribute() != null); foreach (Type type in types) { services.AddScoped(type); } return services; } }