File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using AiRouter . Configuration ;
2+ using AiRouter . Providers ;
3+ using AiRouter . Routing ;
4+ using Microsoft . Extensions . DependencyInjection . Extensions ;
5+
6+ namespace Microsoft . Extensions . DependencyInjection ;
7+
8+ public static class AiRouterServiceCollectionExtensions
9+ {
10+ public static IServiceCollection AddAiRouter (
11+ this IServiceCollection services ,
12+ Action < AiRouterOptions > ? configure = null )
13+ {
14+ ArgumentNullException . ThrowIfNull ( services ) ;
15+
16+ var options = new AiRouterOptions ( ) ;
17+ configure ? . Invoke ( options ) ;
18+
19+ services . TryAddSingleton ( options ) ;
20+ services . TryAddSingleton < IProviderStore , InMemoryProviderStore > ( ) ;
21+ services . TryAddSingleton < IRouteStore , InMemoryRouteStore > ( ) ;
22+ services . TryAddSingleton < IProviderManager , ProviderManager > ( ) ;
23+ services . TryAddSingleton < RouteResolver > ( ) ;
24+ services . TryAddSingleton < IAiRouter , AiRouterService > ( ) ;
25+
26+ return services ;
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments