| | | 1 | | using Microsoft.Extensions.DependencyInjection; |
| | | 2 | | |
| | | 3 | | namespace NexusLabs.Needlr.AgentFramework; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Extension methods for <see cref="IServiceCollection"/> that register the Needlr Agent Framework |
| | | 7 | | /// infrastructure directly, without requiring the <see cref="Injection.ConfiguredSyringe"/> fluent builder. |
| | | 8 | | /// </summary> |
| | | 9 | | /// <remarks> |
| | | 10 | | /// <para> |
| | | 11 | | /// Use this when registering the agent framework from an <see cref="IServiceCollectionPlugin"/> |
| | | 12 | | /// so that feature projects can self-register without modifying the composition root: |
| | | 13 | | /// </para> |
| | | 14 | | /// <code> |
| | | 15 | | /// public sealed class AgentFrameworkPlugin : IServiceCollectionPlugin |
| | | 16 | | /// { |
| | | 17 | | /// public void Configure(ServiceCollectionPluginOptions options) |
| | | 18 | | /// { |
| | | 19 | | /// options.Services.AddNeedlrAgentFramework(); |
| | | 20 | | /// } |
| | | 21 | | /// } |
| | | 22 | | /// </code> |
| | | 23 | | /// <para> |
| | | 24 | | /// This calls the same code path as |
| | | 25 | | /// <see cref="SyringeExtensionsForAgentFramework.UsingAgentFramework(Injection.ConfiguredSyringe)"/> |
| | | 26 | | /// — zero duplication, zero drift between the two entry points. |
| | | 27 | | /// </para> |
| | | 28 | | /// </remarks> |
| | | 29 | | public static class ServiceCollectionAgentFrameworkExtensions |
| | | 30 | | { |
| | | 31 | | /// <summary> |
| | | 32 | | /// Registers the full Needlr Agent Framework infrastructure on the service collection. |
| | | 33 | | /// </summary> |
| | | 34 | | /// <param name="services">The service collection to register into.</param> |
| | | 35 | | /// <returns>The same <paramref name="services"/> instance for chaining.</returns> |
| | | 36 | | public static IServiceCollection AddNeedlrAgentFramework( |
| | | 37 | | this IServiceCollection services) |
| | | 38 | | { |
| | 473 | 39 | | ArgumentNullException.ThrowIfNull(services); |
| | | 40 | | |
| | 473 | 41 | | SyringeExtensionsForAgentFramework.RegisterAgentFrameworkCore(services); |
| | | 42 | | |
| | 473 | 43 | | return services; |
| | | 44 | | } |
| | | 45 | | } |