async static Task Main(string[] args)
        {
            ValueTupleDataTableTest();

            Console.WriteLine("press any key to continue ...");

            Console.ReadLine();

            Console.WriteLine("use MSSQL ...");
            var json =
                @"
{
    sql:
        ""
            set statistics io on
            set statistics time on
            set statistics profile on
            select
                '\""111\""' as F1, *
            from
                sys.objects

            select
                '\""222\""' as F, *
            from
                sys.objects
        ""
}
                        ";

            json = @"
        {
            a: [
                {F1:""asdsa"", F2: 123, F3: ""2019-01-01""}
            ]
        }

";
            var jTokenParameters = JToken.Parse(json);
            var spName           = "usp_executesql";

            spName = "usp_testudt";
            ConcurrentDictionary <string, ExecutingInfo>
            executingCachingStore
                = new ConcurrentDictionary <string, ExecutingInfo>();

            var x = new MsSqlStoreProceduresExecutor(executingCachingStore);

            SqlConnection sqlConnection = new SqlConnection
                                          (
                "Initial Catalog=test;Data Source=gateway.hyper-v.internal\\sql2019,11433;User=sa;Password=!@#123QWE"
                                          )
            {
                StatisticsEnabled = true
            };

            x.CachedParametersDefinitionExpiredInSeconds = 10;

            var entries = x
                          .ExecuteResultsAsAsyncEnumerable
                          (
                sqlConnection
                , spName
                , jTokenParameters
                          );

            await foreach
            (
                var(
                    resultSetIndex
                    , rowIndex
                    , columns
                    , dataRecord
                    )
                in
                entries
            )
            {
                Console.WriteLine
                (
                    $"{nameof(resultSetIndex)}:{resultSetIndex}{{0}}{nameof(rowIndex)}:{rowIndex}{{0}}{nameof(dataRecord)}:{dataRecord[1]}"
                    , "\t"
                );
            }

            Console.WriteLine("press any key to continue ...");
            Console.ReadLine();

            var result = await
                         x
                         .ExecuteJsonResultsAsync
                         (
                sqlConnection
                , spName
                , jTokenParameters
                         );

            Console.WriteLine(result);

            Console.WriteLine("press any key to continue ...");
            Console.ReadLine();

            Console.WriteLine("use MySQL ...");
            ConcurrentDictionary <string, ExecutingInfo> store = new ConcurrentDictionary <string, ExecutingInfo>();
            var xx = new MySqlStoreProceduresExecutor(store);
            var mySqlConnection = new MySqlConnection()
            {
                ConnectionString = "server=gateway.hyper-v.internal;uid=root;pwd=!@#123QWE;database=Test"
            };

            entries = xx.ExecuteResultsAsAsyncEnumerable
                      (
                mySqlConnection
                , "zsp_test"
                , JToken.Parse(@"{ Param1 : ""11""}")
                      );

            await foreach
            (
                var(
                    resultSetIndex
                    , rowIndex
                    , columns
                    , dataRecord
                    )
                in
                entries
            )
            {
                Console.WriteLine
                (
                    $"{nameof(resultSetIndex)}:{resultSetIndex}{{0}}{nameof(rowIndex)}:{rowIndex}{{0}}{nameof(dataRecord)}:{dataRecord[1]}"
                    , "\t"
                );
            }

            Console.WriteLine("Hello World!");
        }
        public void ConfigureServices(IServiceCollection services)
        {
            ConfigurationHelper
            .Load(Configuration);

            services
            .Configure <CsvFormatterOptions>
            (
                Configuration
                .GetSection
                (
                    "ExportCsvFormatter"
                )
            );
            services
            .AddMvc
            (
#if NETCOREAPP3_X
                (option) =>
            {
                option.EnableEndpointRouting = false;
            }
#endif
            )
#if NETCOREAPP3_X
            .AddNewtonsoftJson()
#endif
            //.SetCompatibilityVersion
            //    (
            //        CompatibilityVersion
            //            .Version_2_1
            //    )
            ;

            // for both NETCOREAPP2_X and NETCOREAPP3_X
            // for Sync or Async Action Selector
            services
            .TryAddEnumerable
            (
                ServiceDescriptor
                .Singleton
                <
                    IApplicationModelProvider
                    , ConfigurableActionConstrainedRouteApplicationModelProvider <ConstrainedRouteAttribute>
                >
                (
                    (x) =>
            {
                return
                (new ConfigurableActionConstrainedRouteApplicationModelProvider <ConstrainedRouteAttribute>
                 (
                     Configuration
                     , (attribute) =>
                {
                    return
                    new ConfigurableActionConstraint <ConstrainedRouteAttribute>
                    (
                        attribute
                        , (actionConstraintContext, constrainedRouteAttribute) =>
                    {
                        var r = (actionConstraintContext.Candidates.Count == 1);
                        if (!r)
                        {
                            var routeContext = actionConstraintContext.RouteContext;
                            var httpContext = routeContext
                                              .HttpContext;
                            var request = httpContext
                                          .Request;
                            var type = typeof(AbstractStoreProceduresExecutorControllerBase);
                            var currentCandidateAction = actionConstraintContext
                                                         .CurrentCandidate
                                                         .Action;

                            var isAsyncExecuting = ((ControllerActionDescriptor)currentCandidateAction)
                                                   .MethodInfo
                                                   .IsAsync();
                            var routeName = routeContext
                                            .RouteData
                                            .Values["routeName"]
                                            .ToString();
                            var httpMethod = $"Http{request.Method}";
                            var isAsyncExecutingInConfiguration = false;

                            var accessingConfigurationKey = "DefaultAccessing";
                            if (request.Path.ToString().Contains("/export/", StringComparison.OrdinalIgnoreCase))
                            {
                                accessingConfigurationKey = "exporting";
                            }

                            if
                            (
                                constrainedRouteAttribute
                                .Configuration
                                .TryGetSection
                                (
                                    $"Routes:{routeName}:{httpMethod}:{accessingConfigurationKey}:isAsyncExecuting"
                                    , out var isAsyncExecutingConfiguration
                                )
                            )
                            {
                                isAsyncExecutingInConfiguration = isAsyncExecutingConfiguration.Get <bool>();
                            }
                            r = (isAsyncExecutingInConfiguration == isAsyncExecuting);
                        }
                        return r;
                    }
                    );
                }
                 ));
            }
                )
            );

            //services
            //  .AddSingleton
            //        <JTokenParametersValidateFilterAttribute>
            //            ();

            #region 异步批量入库案例专用
            var processor =
                new SingleThreadAsyncDequeueProcessorSlim <JToken>();
            ConcurrentDictionary <string, ExecutingInfo>
            executingCachingStore
                = new ConcurrentDictionary <string, ExecutingInfo>();
            services
            .AddSingleton(executingCachingStore);
            var executor = new MsSqlStoreProceduresExecutor(executingCachingStore);
            processor
            .StartRunDequeueThreadProcess
            (
                (i, data) =>
            {
                //Debugger.Break();
                var ja = new JArray(data);
                var jo = new JObject
                {
                    ["udt_vcidt"] = ja
                };
                var sqlConnection = new SqlConnection("Initial Catalog=test;Data Source=localhost;User=sa;Password=!@#123QWE");
                executor
                .ExecuteJsonResults
                (
                    sqlConnection
                    , "zsp_Test"
                    , jo
                    ,
                    (
                        resultSetIndex
                        , reader
                        , rowIndex
                        , columnIndex
                        , fieldType
                        , fieldName
                    )
                    =>
                {
                    return(true, null);
                }
                );
            }