locked
LINQ Include() method nullifies whole query RRS feed

  • Question

  • User-1592858483 posted

    I have a code:

    IQueryable<Individual> individuals =  _context.Individuals
                     .Include(i => i.GroupType)
                     .Include(i=>i.DynastyType)
                     .Where(i => i.GroupTypeId == gId);

    And records in my DB:

    Id: 23

    GroupTypeId: 2

    DynastyTypeId: null

    Second Include() method returns null and it makes whole query to return empty object. DynastyType is an optional property, so why it happens?

    Friday, August 18, 2017 12:09 PM

Answers

All replies