コード例 #1
0
        public async Task <int> Run(IClusterClient client)
        {
            var querier = client.GetGrain <IQueryRepository>(0);

            var query = new QueryDefinition {
                AggregationLambda = Aggregator,
                SelectorLambda    = Selector,
                ReturnTypeName    = Type,
                Name            = Name,
                TargetRessource = TargetRessource
            };

            Console.WriteLine($"Compiling \"{Name}\" definition...");
            try {
                var t = Stopwatch.StartNew();
                await querier.CommitQuery(query.AsImmutable());

                Console.WriteLine($"Succesfully compiled \"{Name}\" definition in {t.ElapsedMilliseconds}ms");
                return(0);
            }
            catch (Exception e) {
                Console.WriteLine(e.Message);
                return(1);
            }
        }