mirror of
https://github.com/thebreaddev/Supercell.GUT.git
synced 2024-11-10 07:44:37 +00:00
ad23f95319
only basic messages, wip.
20 lines
626 B
C#
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;
|
|
}
|
|
}
|