protected override Expression VisitQuerySourceReference(
            QuerySourceReferenceExpression expression)
        {
            var entityType = _model.FindEntityType(expression.Type);

            if (entityType != null)
            {
                _entityTrackingInfos.Add(
                    _entityTrackingInfoFactory
                    .Create(_queryCompilationContext, expression, entityType));
            }

            return(expression);
        }
        protected override Expression VisitQuerySourceReference(
            QuerySourceReferenceExpression querySourceReferenceExpression)
        {
            if (!_untrackedQuerySources.Contains(querySourceReferenceExpression.ReferencedQuerySource))
            {
                var entityType = _model.FindEntityType(querySourceReferenceExpression.Type);

                if (entityType != null)
                {
                    _entityTrackingInfos.Add(
                        _entityTrackingInfoFactory
                        .Create(_queryCompilationContext, querySourceReferenceExpression, entityType));
                }
            }

            return(querySourceReferenceExpression);
        }
Пример #3
0
        /// <summary>
        ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
        ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
        ///     any release. You should only use it directly in your code with extreme caution and knowing that
        ///     doing so can result in application failures when updating to a new Entity Framework Core release.
        /// </summary>
        protected override Expression VisitQuerySourceReference(
            QuerySourceReferenceExpression expression)
        {
            var sequenceType = expression.Type.TryGetSequenceType();

            var entityType
                = _queryCompilationContext.FindEntityType(expression.ReferencedQuerySource)
                  ?? ((sequenceType != null
                          ? _model.FindEntityType(sequenceType)
                          : null)
                      ?? _model.FindEntityType(expression.Type));

            if (entityType?.FindPrimaryKey() != null)
            {
                _entityTrackingInfos.Add(
                    _entityTrackingInfoFactory
                    .Create(_queryCompilationContext, expression, entityType));
            }

            return(expression);
        }