Exemple #1
0
        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);
        }
Exemple #3
0
        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);
            });
        }
Exemple #5
0
        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;
 }
Exemple #8
0
        private static async Task UnaryCallExample(IGreeterService client)
        {
            var reply = await client.SayHelloAsync("GreeterClient");

            Console.WriteLine("Greeting: " + reply);
        }
Exemple #9
0
 public HiController(IGreeterService greeterService)
 {
     this.greeterService = greeterService;
 }
 public GreeterRpcService(IGreeterService greeterService)
 {
     GreeterService = greeterService;
 }
Exemple #11
0
 public GreetingModel(IGreeterService greeter)
 {
     _greeter = greeter;
 }
Exemple #12
0
 public IndexHandler(IGreeterService greeterService)
 {
     _greeterService = greeterService;
 }
Exemple #13
0
 public GreeterController()
 {
     _dateTimeService = new DateTimeService();
     _greeterService  = new GreeterService(_dateTimeService);
 }
Exemple #14
0
 public GreeterController(IGreeterService greeterService, IDateTimeService dateTimeService)
 {
     _greeterService  = greeterService;
     _dateTimeService = dateTimeService;
 }
Exemple #15
0
 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;
 }
Exemple #18
0
 public GreeterService(IGreeterService greeterService)
 {
     this._greeterService = greeterService;
 }
 public HomeController(IRestaurantData restaurantService, IGreeterService greeterService)
 {
     _restaurantService = restaurantService;
     _greeterService    = greeterService;
 }
 public GreeterViewComponent(IGreeterService greeter)
 {
     _greeter = greeter;
 }