Supercell.GUT/Supercell.GUT.Server/Protocol/Extensions/ServiceCollectionExtensions.cs
BreadDEV ad23f95319 [v0.0.1] very early state server
only basic messages, wip.
2024-03-04 20:19:32 +07:00

20 lines
626 B
C#

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<Type> types = Assembly.GetExecutingAssembly().GetTypes()
.Where(t => t.GetCustomAttribute<ServiceNodeAttribute>() != null);
foreach (Type type in types)
{
services.AddScoped(type);
}
return services;
}
}