示例#1
0
        public static async Task LoadTestForQuery(ServiceTable serviceTable, VersionTable versionTable)
        {
            var stopWatch = new Stopwatch();

            stopWatch.Start();
            var version = await versionTable.GetCurrent(ResourceType.Service);

            if (version != null)
            {
                stopWatch.Stop();
                Console.WriteLine($"verion: {version.RowKey}, takes {stopWatch.ElapsedMilliseconds} milli-seconds");
            }
            stopWatch.Start();
            var services = await serviceTable.GetFromParitionKey(version.RowKey);

            var models = new List <ServiceViewModel>();

            foreach (var entity in services)
            {
                try
                {
                    models.Add(ServiceViewModel.FromEntity((ServiceEntity)entity));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
            stopWatch.Stop();
            Console.WriteLine($"query {models.Count} takes {stopWatch.ElapsedMilliseconds} milli-seconds");
        }