public void ConfigureServices(IServiceCollection services) { services.AddStandardTemplate((svc, resolver) => { var config = resolver.GetService <IConfiguration>(); var cartChannel = new Channel(config["RpcClients:CartService"], ChannelCredentials.Insecure); var cartClient = new MyCartService.CartServiceClient(cartChannel); var inventoryChannel = new Channel(config["RpcClients:InventoryService"], ChannelCredentials.Insecure); var inventoryClient = new MyInventoryService.InventoryServiceClient(inventoryChannel); var reviewChannel = new Channel(config["RpcClients:ReviewService"], ChannelCredentials.Insecure); var reviewClient = new MyReviewService.ReviewServiceClient(reviewChannel); services.AddSingleton(typeof(MyCartService.CartServiceClient), cartClient); services.AddSingleton(typeof(MyInventoryService.InventoryServiceClient), inventoryClient); services.AddSingleton(typeof(MyReviewService.ReviewServiceClient), reviewClient); }); }
public CartController(MyCartService.CartServiceClient cartServiceClient) { _cartServiceClient = cartServiceClient; }