Пример #1
0
        private void Test()
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            var exepression = new EntityExepression();
            EntityInterpreterContext context = null;;
            int count = 1;

            for (int i = 0; i < count; i++)
            {
                context = new EntityInterpreterContext(userOperatorActionFormat, JsonConvert.DeserializeObject(strJson));
                exepression.Interpreter(context);
            }
            stopwatch.Stop();
            Console.WriteLine($"解析{count}次用时【{stopwatch.Elapsed.TotalMilliseconds}】毫秒");
            Console.WriteLine("解析结果为:");
            Console.WriteLine(context.Result);
        }
Пример #2
0
        private void SetFormatValue()
        {
            var collectionExepression = new CollectionExepression();
            var entityExepression     = new EntityExepression();

            foreach (var item in formates)
            {
                if (item.IsCollection)
                {
                    var context = new CollectionInterpreterContext(item.Key, item.Data);
                    collectionExepression.Interpreter(context);
                    item.FormatValue.AddRange(context.Result);
                }
                else
                {
                    var context = new EntityInterpreterContext(item.Key, item.Data);
                    entityExepression.Interpreter(context);
                    item.FormatValue.Add(context.Result);
                }
            }
        }