What is a correct way to select a property of optional navigation property in Entity Framework?
问题 What is a correct way to select a property of optional navigation property entity framework? I am concerned that in case the navigation property will be null, then the error will be thrown when I try to access its (optional navigation property`s) property. Here is what I tried: return await this.relatedCasesRepository .GetAll() .AsNoTracking() .Where(rc => rc.FirstCaseId == caseId || rc.SecondCaseId == caseId) .Select(rc => new RelatedCaseInfoDto { FirstCaseId = rc.FirstCaseId, FirstCaseName