static void Main(string[] args) { ChannelFactory <IGreeterService> factory = new ChannelFactory <IGreeterService>("GreeterService"); IGreeterService client = factory.CreateChannel(); var res = client.Get(new Request() { Name = "liam", Age = 18 }); Console.WriteLine(res.GreetInfo); Console.ReadKey(); }
public _Default() { var typeName = ConfigurationManager.AppSettings["serviceClass"]; var type = Type.GetType(typeName); if (type == null) { throw new Exception(string.Format("Type not found {0}", typeName)); } GreeterService = (IGreeterService)Activator.CreateInstance(type); }
public HomeModule(IGreeterService greeter) { Get("/", args => { return(View["index.html", greeter.GetGreeting()]); }); Get("/test", args => greeter.GetGreeting()); Get("/os", x => { return(System.Runtime.InteropServices.RuntimeInformation.OSDescription); }); }
public HomeModule(IGreeterService greeter) { //https://blog.nandotech.com/post/2016-10-25-nancyfx-webapi-dapper/ Get("/", args => { return(greeter.GetGreeting()); }); Get("/test", args => greeter.GetGreeting()); Get("/os", x => { return(System.Runtime.InteropServices.RuntimeInformation.OSDescription); }); }
private static async Task ServerStreamingCallExample(IGreeterService client) { using var tokenSource = new CancellationTokenSource(); tokenSource.CancelAfter(TimeSpan.FromSeconds(5)); try { await foreach (var reply in client.SayHellosAsync("GreeterClient", tokenSource.Token)) { Console.WriteLine("Greeting: " + reply); } } catch (RpcException ex) when(ex.StatusCode == StatusCode.Cancelled) { // handle Status(StatusCode="Cancelled", Detail="Call canceled by the client.") Console.WriteLine("Call canceled by the client."); } }
public GreeterController() { _dateTimeService = new DateTimeService(); _greeterService = new GreeterService(_dateTimeService); }
public GreeterController(IGreeterService greeterService, IDateTimeService dateTimeService) { _greeterService = greeterService; _dateTimeService = dateTimeService; }
private static async Task UnaryCallExample(IGreeterService client) { var reply = await client.SayHelloAsync("GreeterClient"); Console.WriteLine("Greeting: " + reply); }
public HiController(IGreeterService greeterService) { this.greeterService = greeterService; }
public GreeterRpcService(IGreeterService greeterService) { GreeterService = greeterService; }
public GreetingModel(IGreeterService greeter) { _greeter = greeter; }
public IndexHandler(IGreeterService greeterService) { _greeterService = greeterService; }
public HttpFunction(IGreeterService greeter) { _greeter = greeter; }
/// <summary> /// Hello constructor /// </summary> public HelloController(ILogger <HelloController> logger, IGreeterService service) { _logger = logger; _service = service; }
public GreeterController(IGreeterService greeterService) { GreeterService = greeterService; }
public GreeterService(IGreeterService greeterService) { this._greeterService = greeterService; }
public HomeController(IRestaurantData restaurantService, IGreeterService greeterService) { _restaurantService = restaurantService; _greeterService = greeterService; }
public GreeterViewComponent(IGreeterService greeter) { _greeter = greeter; }