Exemplo n.º 1
0
        public async Task <IEnumerable <string> > Get()
        {
            ICounter counter =
                ServiceProxy.Create <ICounter>(new Uri("fabric:/MyApplication/MyStatefulService"), new ServicePartitionKey(0));

            long count = await counter.GetCountAsync();

            return(new string[] { count.ToString() });
        }
Exemplo n.º 2
0
        public async Task <IActionResult> About()
        {
            ICounter counter = ServiceProxy.Create <ICounter>(new Uri("fabric:/Application1/StatefulSvc"), new ServicePartitionKey(0));

            long count = await counter.GetCountAsync();

            ViewData["Message"] = count.ToString();

            return(View());
        }
Exemplo n.º 3
0
        public async Task <IEnumerable <string> > Get()
        {
            // Talk to a stateless SERVICE to get the counter
            ICounter counter =
                ServiceProxy.Create <ICounter>(0, new Uri(theApplicationUri + "/FirstStatefulService"));
            long count = await counter.GetCountAsync();

            // Talk to a stateless ACTOR to get a random number
            string theRandomNum = "42.0";
            var    simpleActor  = ActorProxy.Create <IVerySimpleActor>(ActorId.NewId(), theApplicationUri);

            theRandomNum = await simpleActor.GetRandomValue();

            return(new string[] { String.Format("Hello world! Here's the count : {0} and here's a random number {1:0.00}", count.ToString(), theRandomNum) });
        }