@@ -24,7 +24,6 @@ public void Register<THttpApi, TTokenPrivder>(string alias) where TTokenPrivder
2424 {
2525 var httpApiType = typeof ( THttpApi ) ;
2626 var serviceType = typeof ( TokenProviderService < THttpApi , TTokenPrivder > ) ;
27- var serviceDescriptor = new AliasServiceDescriptor ( serviceType ) ;
2827
2928 if ( this . httpApiServiceDescriptors . TryGetValue ( httpApiType , out var existDescriptor ) &&
3029 existDescriptor . ServiceType == serviceType )
@@ -33,7 +32,7 @@ public void Register<THttpApi, TTokenPrivder>(string alias) where TTokenPrivder
3332 }
3433 else
3534 {
36- serviceDescriptor . AddAlias ( alias ) ;
35+ var serviceDescriptor = new AliasServiceDescriptor ( serviceType , alias ) ;
3736 this . httpApiServiceDescriptors [ httpApiType ] = serviceDescriptor ;
3837 }
3938 }
@@ -54,7 +53,7 @@ public bool TryGetValue(Type httpApiType, [MaybeNullWhen(false)] out AliasServic
5453 /// </summary>
5554 public class AliasServiceDescriptor
5655 {
57- private readonly HashSet < string > aliasSet = [ ] ;
56+ private readonly HashSet < string > aliasSet ;
5857
5958 /// <summary>
6059 /// 获取服务类型
@@ -65,9 +64,11 @@ public class AliasServiceDescriptor
6564 /// 别名的服务描述
6665 /// </summary>
6766 /// <param name="serviceType">服务类型</param>
68- public AliasServiceDescriptor ( Type serviceType )
67+ /// <param name="alias"></param>
68+ public AliasServiceDescriptor ( Type serviceType , string alias )
6969 {
7070 this . ServiceType = serviceType ;
71+ this . aliasSet = [ alias ] ;
7172 }
7273
7374 /// <summary>
0 commit comments