コード例 #1
0
        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);
            });
        }
コード例 #2
0
 public InventoryController(MyInventoryService.InventoryServiceClient inventoryServiceClient)
 {
     _inventoryServiceClient = inventoryServiceClient;
 }
コード例 #3
0
 public DbMigrationController(MyInventoryService.InventoryServiceClient inventoryServiceClient)
 {
     _inventoryServiceClient = inventoryServiceClient;
 }