public override Expression Visit(Expression node)
            {
                if (node != null)
                {
                    var type = _derivationVisitor.Visit(node);

                    if (type != null)
                    {
                        _findEntityDataTypes.Visit(type);
                    }
                }

                return(base.Visit(node));
            }
        /// <summary>
        /// Visits the expression to rewrite types.
        /// </summary>
        /// <param name="node">Expression to visit.</param>
        /// <returns>Expression with types rewritten.</returns>
        public override Expression Visit(Expression node)
        {
#if !USE_SLIM
            //
            // NB: In .NET Core, DynamicExpression is an extension node, causing reduction upon calling Visit. We don't want this reduction
            //     to take place, because it introduces an opaque Constant node containing a call site object for which we can't substitute
            //     types. As such, we need to type check here and dispatch ourselves.
            //

            if (node is DynamicExpression d)
            {
                return(VisitDynamic(d));
            }
#endif

            var res = base.Visit(node);

            if (res != null)
            {
#if USE_SLIM
                var derivationVisitor = new TypeSlimDerivationVisitor();
                var resType           = derivationVisitor.Visit(res);
                var newType           = resType != null?VisitType(resType) : null;
#else
                var newType = VisitType(res.Type);
                var resType = res.Type;
#endif

                if (newType != resType)
                {
                    res = ConvertExpression(node, res, newType);
                }
            }

            return(res);
        }