LINQ Include is not working as expected .net core 3.1

Viewed 116

I just upgraded the application from .net core 2.2 to .net core 3.1

Encounter this issue. I have following methods:

var firstResult = await _context.UserCompany.Include(x => x.User).ToListAsync();

and

var secondResult = await _context.UserCompany.Include(x => x.User)
                                             .Where(x=>x.IsExecutive).ToListAsync();

In the firstResult, the navigation property User is populated. In the secondResult, the navigation property User is null.

Why is that?

0 Answers
Related