/// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        protected override Expression VisitNew(NewExpression expression)
        {
            var newArguments = Visit(expression.Arguments).ToList();

            for (var i = 0; i < newArguments.Count; i++)
            {
                if (newArguments[i].Type == typeof(ValueBuffer))
                {
                    newArguments[i]
                        = _queryModelVisitor
                          .BindReadValueMethod(expression.Arguments[i].Type, newArguments[i], 0);
                }
            }

            return(expression.Update(newArguments));
        }
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        protected override Expression VisitNew(NewExpression expression)
        {
            var newArguments = Visit(expression.Arguments).ToList();

            if (expression.Constructor != MaterializationContext.ObsoleteConstructor)
            {
                for (var i = 0; i < newArguments.Count; i++)
                {
                    if (newArguments[i].Type == typeof(ValueBuffer))
                    {
                        newArguments[i] = _queryModelVisitor
                                          .BindReadValueMethod(expression.Arguments[i].Type, newArguments[i], 0);
                    }
                }
            }

            return(expression.Update(newArguments));
        }