Is it possible to disable proxy in one Entity Framework query?

Viewed 771

Is it possible to disable proxy in Entity Framework in one dedicated query? I don't want to impact on rest of solution.

I want to turn off proxy objects and get 'native' Goal and GoalProgressItem. How to get non-proxy objects.

var goalWithProgressItemsPairs = _dbContext.GoalProgressItems
    .Include(p => p.Goal)
    .Where(p => p.Date >= range.From && p.Date <= range.To)
    .Select(p =>
        new
        {
            Goal = p.Goal,
            ProgressItem = p
        }
    )
    .ToList();
1 Answers
Related