示例#1
0
        public async Task <int> Run(CSharpRepl repl, IClusterClient client)
        {
            try {
                var querier = client.GetGrain <IGenericQuerier>(0);
                var res     = await querier.Query(Name.AsImmutable());

                IFormatter formatter = new BinaryFormatter();
                Stream     stream    = new MemoryStream(res.Value.Item2, false);
                var        obj       = formatter.Deserialize(stream);
                stream.Close();

                if (VariableName != null)
                {
                    await repl.AddToState(obj, VariableName, res.Value.Item1);
                }
                else
                {
                    await repl.Display(obj, res.Value.Item1);
                }
                return(0);
            }
            catch (Exception e) {
                Console.WriteLine(e.Message);
                return(1);
            }
        }