Esempio n. 1
0
 /// <summary>Register service method with a service binder with or without implementation. Useful when customizing the  service binding logic.
 /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
 /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static void BindService(grpc::ServiceBinderBase serviceBinder, CarDealingBase serviceImpl)
 {
     serviceBinder.AddMethod(__Method_Login, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Cardealer.User, global::Cardealer.Session_Id>(serviceImpl.Login));
     serviceBinder.AddMethod(__Method_Logout, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Cardealer.Session_Id, global::Cardealer.Result>(serviceImpl.Logout));
     serviceBinder.AddMethod(__Method_Balance, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Cardealer.BalanceRequest, global::Cardealer.BalanceResponse>(serviceImpl.Balance));
     serviceBinder.AddMethod(__Method_ListCars, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod <global::Cardealer.ListCarsRequest, global::Cardealer.ListCarsResponse>(serviceImpl.ListCars));
     serviceBinder.AddMethod(__Method_ActualCar, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Cardealer.ActualCarRequest, global::Cardealer.ActualCarResponse>(serviceImpl.ActualCar));
     serviceBinder.AddMethod(__Method_PurchaseCar, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Cardealer.PurchaseCarRequest, global::Cardealer.PurchaseCarResponse>(serviceImpl.PurchaseCar));
     serviceBinder.AddMethod(__Method_SellCar, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Cardealer.SellCarRequest, global::Cardealer.SellCarResponse>(serviceImpl.SellCar));
     serviceBinder.AddMethod(__Method_RepairCar, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Cardealer.RepairCarRequest, global::Cardealer.RepairCarResponse>(serviceImpl.RepairCar));
 }
Esempio n. 2
0
 /// <summary>Creates service definition that can be registered with a server</summary>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static grpc::ServerServiceDefinition BindService(CarDealingBase serviceImpl)
 {
     return(grpc::ServerServiceDefinition.CreateBuilder()
            .AddMethod(__Method_Login, serviceImpl.Login)
            .AddMethod(__Method_Logout, serviceImpl.Logout)
            .AddMethod(__Method_Balance, serviceImpl.Balance)
            .AddMethod(__Method_ListCars, serviceImpl.ListCars)
            .AddMethod(__Method_ActualCar, serviceImpl.ActualCar)
            .AddMethod(__Method_PurchaseCar, serviceImpl.PurchaseCar)
            .AddMethod(__Method_SellCar, serviceImpl.SellCar)
            .AddMethod(__Method_RepairCar, serviceImpl.RepairCar).Build());
 }