I have a query here that fetches a single entity object and only one nested entity that meets a specific condition, but I'm receiving an error when executing it.
Here is the query
Profile profile = dbContext.Profiles.Where(i => i.ApplicationUserGuid == guiId)
.Include(i => i.ProfileImages.Where(k => k.IsMainImage == true)).First();
And here is the exception error message
The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties. Parameter name: path
I also tried running it with another .First(), but still same error message
Profile profile = dbContext.Profiles.Where(i => i.ApplicationUserGuid == guiId)
.Include(i => i.ProfileImages.Where(k => k.IsMainImage == true).First()).First();