1- using KSFramework . Messaging . Abstraction ;
2- using Microsoft . Extensions . DependencyInjection ;
3- using System . Reflection ;
4-
5- namespace KSFramework . Messaging . Configuration
6- {
7- /// <summary>
8- /// Extension methods to register messaging components into the service collection.
9- /// </summary>
10- public static class ServiceCollectionExtensions
11- {
12- /// <summary>
13- /// Registers mediator handlers and behaviors from specified assemblies with automatic discovery.
14- /// </summary>
15- public static IServiceCollection AddKSMediator ( this IServiceCollection services , params Assembly [ ] assemblies )
16- {
17- services . AddScoped < IMediator , Mediator > ( ) ;
18- services . AddScoped < ISender > ( sp => sp . GetRequiredService < IMediator > ( ) ) ;
19-
20- services . Scan ( scan => scan
21- . FromAssemblies ( assemblies )
22-
23- // Request Handlers
24- . AddClasses ( c => c . AssignableTo ( typeof ( IRequestHandler < , > ) ) )
25- . AsImplementedInterfaces ( )
26- . WithScopedLifetime ( )
27-
28- // Notification Handlers
29- . AddClasses ( c => c . AssignableTo ( typeof ( INotificationHandler < > ) ) )
30- . AsImplementedInterfaces ( )
31- . WithScopedLifetime ( )
32-
33- // Pipeline Behaviors
34- . AddClasses ( c => c . AssignableTo ( typeof ( IPipelineBehavior < , > ) ) )
35- . AsImplementedInterfaces ( )
36- . WithScopedLifetime ( )
37-
38- // Notification Behaviors
39- . AddClasses ( c => c . AssignableTo ( typeof ( INotificationBehavior < > ) ) )
40- . AsImplementedInterfaces ( )
41- . WithScopedLifetime ( )
42- ) ;
43-
44- return services ;
45- }
46- }
47- }
1+ // using KSFramework.Messaging.Abstraction;
2+ // using Microsoft.Extensions.DependencyInjection;
3+ // using System.Reflection;
4+ //
5+ // namespace KSFramework.Messaging.Configuration
6+ // {
7+ // /// <summary>
8+ // /// Extension methods to register messaging components into the service collection.
9+ // /// </summary>
10+ // public static class ServiceCollectionExtensions
11+ // {
12+ // /// <summary>
13+ // /// Registers mediator handlers and behaviors from specified assemblies with automatic discovery.
14+ // /// </summary>
15+ // public static IServiceCollection AddKSMediator(this IServiceCollection services, params Assembly[] assemblies)
16+ // {
17+ // services.AddScoped<IMediator, Mediator>();
18+ // services.AddScoped<ISender>(sp => sp.GetRequiredService<IMediator>());
19+ //
20+ // services.Scan(scan => scan
21+ // .FromAssemblies(assemblies)
22+ //
23+ // // Request Handlers
24+ // .AddClasses(c => c.AssignableTo(typeof(IRequestHandler<,>)))
25+ // .AsImplementedInterfaces()
26+ // .WithScopedLifetime()
27+ //
28+ // // Notification Handlers
29+ // .AddClasses(c => c.AssignableTo(typeof(INotificationHandler<>)))
30+ // .AsImplementedInterfaces()
31+ // .WithScopedLifetime()
32+ //
33+ // // Pipeline Behaviors
34+ // .AddClasses(c => c.AssignableTo(typeof(IPipelineBehavior<,>)))
35+ // .AsImplementedInterfaces()
36+ // .WithScopedLifetime()
37+ //
38+ // // Notification Behaviors
39+ // .AddClasses(c => c.AssignableTo(typeof(INotificationBehavior<>)))
40+ // .AsImplementedInterfaces()
41+ // .WithScopedLifetime()
42+ // );
43+ //
44+ // return services;
45+ // }
46+ // }
47+ // }
0 commit comments