Exemplo n.º 1
0
 public static IServiceCollection AddGrpcClient <TServiceInterface>(
     this IServiceCollection serviceCollection,
     GrpcClientOptions options
     )
     where TServiceInterface : class, IGrpcService
 {
     serviceCollection.AddGrpcClient <TServiceInterface>(options, Serializer);
     return(serviceCollection);
 }
Exemplo n.º 2
0
 public static IServiceCollection AddGrpcClient <TServiceInterface>(
     this IServiceCollection serviceCollection,
     GrpcClientOptions options,
     ISerializer serializer
     )
     where TServiceInterface : class, IGrpcService
 {
     serviceCollection.AddSingleton <TServiceInterface>(_ => GrpcClientFactory.Create <TServiceInterface>(options, serializer));
     return(serviceCollection);
 }
Exemplo n.º 3
0
        public static TService Create <TService>(GrpcClientOptions options, ISerializer serializer) where TService : class, IGrpcService
        {
            var newType = new GrpcClientTypeBuilder().Create <TService>();

            return((TService)Activator.CreateInstance(newType, options, serializer));
        }