Files
EchoHub/docs/auriondocs/Code/src/EchoHub.Server.Irc/IrcServiceExtensions.cs.md
T
Hue 607217b314 docs: Update documentation for 145 files
Generated by AurionDocs
Job ID: 934f8c39-8082-4942-8d17-72ed8f5f8d50
Source commit: 40aea9a
2026-07-23 11:44:20 +02:00

1.5 KiB

IrcServiceExtensions

File: src/EchoHub.Server.Irc/IrcServiceExtensions.cs
Kind: class

public static class IrcServiceExtensions

Extends WebApplicationBuilder with AddIrcGateway to wire IRC gateway support into an ASP.NET Core app. It configures IrcOptions from configuration and, when Irc:Enabled is true, registers IrcGatewayService as a singleton, wires IChatBroadcaster to IrcBroadcaster, and adds the gateway as a hosted service, returning the original builder for fluent chaining.

Remarks

This extension encapsulates opt-in startup logic and centralizes the wiring of the IRC gateway, ensuring consistent DI lifetimes and configuration handling across the app. It coordinates the lifecycle of IrcGatewayService and the broadcaster (IChatBroadcaster implemented by IrcBroadcaster) by hosting the gateway as a background service.

Notes

  • Calling AddIrcGateway multiple times can register multiple hosted services and singletons; call it once during startup to avoid duplicate registrations.
  • The extension only activates when Irc:Enabled is true. If the flag is false or missing, it will configure IrcOptions but will not start or register the gateway components. Ensure configuration sources are loaded before invocation.