private static async Task AddValueProviderAsync(ValueProviderFactoryContext context)
        {
            var request = context.ActionContext.HttpContext.Request;
            var valueProvider = new JQueryFormValueProvider(
                BindingSource.Form,
                await GetValueCollectionAsync(request),
                CultureInfo.CurrentCulture);

            context.ValueProviders.Add(valueProvider);
        }
        /// <inheritdoc />
        public Task CreateValueProviderAsync(ValueProviderFactoryContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var request = context.ActionContext.HttpContext.Request;
            if (request.HasFormContentType)
            {
                // Allocating a Task only when the body is form data.
                return AddValueProviderAsync(context);
            }

            return TaskCache.CompletedTask;
        }
 public Task CreateValueProviderAsync(ValueProviderFactoryContext context)
 {
     context.ValueProviders.Add(_valueProvider);
     return TaskCache.CompletedTask;
 }