Skip to content

Commit 598aa7c

Browse files
committed
类型重命名
1 parent 2c29f50 commit 598aa7c

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

WebApiClient/HttpApiFactory.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ public partial class HttpApiFactory : IHttpApiFactory, _IHttpApiFactory
3434
private readonly Func<Type, Lazy<ActiveHandlerEntry>> activeEntryFactory;
3535

3636
/// <summary>
37-
/// http接口客户端选项
37+
/// http接口代理创建选项
3838
/// </summary>
39-
private readonly ConcurrentDictionary<Type, TypedClientOption> typedClientOptions;
39+
private readonly ConcurrentDictionary<Type, HttpApiCreateOption> httpApiCreateOptions;
4040

4141
/// <summary>
4242
/// 激活的记录
@@ -99,7 +99,7 @@ public HttpApiFactory()
9999
{
100100
this.expiredEntries = new ConcurrentQueue<ExpiredHandlerEntry>();
101101
this.activeEntries = new ConcurrentDictionary<Type, Lazy<ActiveHandlerEntry>>();
102-
this.typedClientOptions = new ConcurrentDictionary<Type, TypedClientOption>();
102+
this.httpApiCreateOptions = new ConcurrentDictionary<Type, HttpApiCreateOption>();
103103
this.activeEntryFactory = apiType => new Lazy<ActiveHandlerEntry>(() => this.CreateActiveEntry(apiType), LazyThreadSafetyMode.ExecutionAndPublication);
104104

105105
this.RegisteCleanup();
@@ -119,13 +119,13 @@ public void AddHttpApi<TInterface>(Action<HttpApiConfig> config, Func<HttpMessag
119119
handlerFactory = () => new DefaultHttpClientHandler();
120120
}
121121

122-
var options = new TypedClientOption
122+
var options = new HttpApiCreateOption
123123
{
124124
ConfigAction = config,
125125
HandlerFactory = handlerFactory
126126
};
127127

128-
var state = this.typedClientOptions.TryAdd(typeof(TInterface), options);
128+
var state = this.httpApiCreateOptions.TryAdd(typeof(TInterface), options);
129129
if (state == false)
130130
{
131131
throw new InvalidOperationException($"接口{typeof(TInterface)}不能重复注册");
@@ -151,7 +151,7 @@ public TInterface CreateHttpApi<TInterface>() where TInterface : class, IHttpApi
151151
/// <returns></returns>
152152
private ActiveHandlerEntry CreateActiveEntry(Type apiType)
153153
{
154-
if (this.typedClientOptions.TryGetValue(apiType, out var option) == false)
154+
if (this.httpApiCreateOptions.TryGetValue(apiType, out var option) == false)
155155
{
156156
throw new ArgumentException($"未注册的接口类型{apiType}");
157157
}

WebApiClient/Internal/HttpApiClientFactories/ActiveHandlerEntry.cs renamed to WebApiClient/Internal/HttpApiFactories/ActiveHandlerEntry.cs

File renamed without changes.

WebApiClient/Internal/HttpApiClientFactories/ExpiredHandlerEntry.cs renamed to WebApiClient/Internal/HttpApiFactories/ExpiredHandlerEntry.cs

File renamed without changes.

WebApiClient/Internal/HttpApiClientFactories/TypedClientOption.cs renamed to WebApiClient/Internal/HttpApiFactories/HttpApiCreateOption.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
namespace WebApiClient
55
{
66
/// <summary>
7-
/// 表示类型客户端选项
7+
/// 表示HttpApi创建选项
88
/// </summary>
9-
class TypedClientOption
9+
class HttpApiCreateOption
1010
{
1111
/// <summary>
12-
/// 获取或设置配置项
12+
/// 获取或设置配置委托
1313
/// </summary>
1414
public Action<HttpApiConfig> ConfigAction { get; set; }
1515

1616
/// <summary>
17-
/// 获取或设置Handler的创建工厂
17+
/// 获取或设置HttpMessageHandler的创建工厂
1818
/// </summary>
1919
public Func<HttpMessageHandler> HandlerFactory { get; set; }
2020
}

WebApiClient/Internal/HttpApiClientFactories/IHttpApiFactory.cs renamed to WebApiClient/Internal/HttpApiFactories/IHttpApiFactory.cs

File renamed without changes.

WebApiClient/Internal/HttpApiClientFactories/LifeTimeTrackingHandler.cs renamed to WebApiClient/Internal/HttpApiFactories/LifeTimeTrackingHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace WebApiClient
44
{
55
/// <summary>
6-
/// 表示具有生命周期监视的Handler
6+
/// 表示具有生命周期自动监视的Handler
77
/// </summary>
88
class LifeTimeTrackingHandler : DelegatingHandler
99
{

0 commit comments

Comments
 (0)