Skip to content

Commit 32fb0e2

Browse files
authored
Adjust ServicesExtensions to GrpcClientServiceExtensions (#136)
1 parent 6cb2ef8 commit 32fb0e2

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/protobuf-net.Grpc.ClientFactory/ServicesExtensions.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,34 @@ public static IHttpClientBuilder AddCodeFirstGrpcClient<T>(this IServiceCollecti
2525
string name) where T : class
2626
=> services.AddGrpcClient<T>(name).ConfigureCodeFirstGrpcClient<T>();
2727

28+
/// <summary>
29+
/// Registers a provider that can recognize and handle code-first services
30+
/// </summary>
31+
public static IHttpClientBuilder AddCodeFirstGrpcClient<T>(this IServiceCollection services,
32+
string name, Action<GrpcClientFactoryOptions> configureClient) where T : class
33+
=> services.AddGrpcClient<T>(name, configureClient).ConfigureCodeFirstGrpcClient<T>();
34+
35+
/// <summary>
36+
/// Registers a provider that can recognize and handle code-first services
37+
/// </summary>
38+
public static IHttpClientBuilder AddCodeFirstGrpcClient<T>(this IServiceCollection services,
39+
string name, Action<IServiceProvider, GrpcClientFactoryOptions> configureClient) where T : class
40+
=> services.AddGrpcClient<T>(name, configureClient).ConfigureCodeFirstGrpcClient<T>();
41+
2842
/// <summary>
2943
/// Registers a provider that can recognize and handle code-first services
3044
/// </summary>
3145
public static IHttpClientBuilder AddCodeFirstGrpcClient<T>(this IServiceCollection services,
3246
Action<GrpcClientFactoryOptions> configureClient) where T : class
3347
=> services.AddGrpcClient<T>(configureClient).ConfigureCodeFirstGrpcClient<T>();
3448

49+
/// <summary>
50+
/// Registers a provider that can recognize and handle code-first services
51+
/// </summary>
52+
public static IHttpClientBuilder AddCodeFirstGrpcClient<T>(this IServiceCollection services,
53+
Action<IServiceProvider, GrpcClientFactoryOptions> configureClient) where T : class
54+
=> services.AddGrpcClient<T>(configureClient).ConfigureCodeFirstGrpcClient<T>();
55+
3556
/// <summary>
3657
/// Configures the provided client-builder to use code-first GRPC for client creation
3758
/// </summary>

0 commit comments

Comments
 (0)